diff options
author | brapru <brapru@pm.me> | 2021-08-11 22:49:18 -0400 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-08-13 20:30:19 +0430 |
commit | 6743170f4ef8ac1ece0985fe400e51dc3ece5ef5 (patch) | |
tree | f31faa0bf1128fd311b86263c4ab88b1144acf34 /Kernel/Net/TCPSocket.cpp | |
parent | 8059f28977a40beb3b703c218b5128a7c71ecd06 (diff) | |
download | serenity-6743170f4ef8ac1ece0985fe400e51dc3ece5ef5.zip |
Kernel: Clear SO_ERROR on successful socket connection
When TCP sockets successfully establish a connection, any SO_ERROR
should be cleared back to success. For example, SO_ERROR gets set to
EINPROGRESS on asynchronous connect calls and should be cleared when
the socket moves to the Established state.
Diffstat (limited to 'Kernel/Net/TCPSocket.cpp')
-rw-r--r-- | Kernel/Net/TCPSocket.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp index c1ea1abd8c..4cae65183c 100644 --- a/Kernel/Net/TCPSocket.cpp +++ b/Kernel/Net/TCPSocket.cpp @@ -38,8 +38,10 @@ void TCPSocket::set_state(State new_state) m_state = new_state; - if (new_state == State::Established && m_direction == Direction::Outgoing) + if (new_state == State::Established && m_direction == Direction::Outgoing) { m_role = Role::Connected; + [[maybe_unused]] auto rc = set_so_error(KSuccess); + } if (new_state == State::Closed) { closing_sockets().with_exclusive([&](auto& table) { |