summaryrefslogtreecommitdiff
path: root/Kernel/Net
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-04-30 19:19:53 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-30 23:11:56 +0200
commit866e577f1d62837b2c8a0ca8651b1e154292cc58 (patch)
treeb41676bde80c5dfe605c932075b7084e144e2a17 /Kernel/Net
parentd8f92bdf96afa7656851ee87b2f7d764664db9c0 (diff)
downloadserenity-866e577f1d62837b2c8a0ca8651b1e154292cc58.zip
Kernel: Don't put closed/listener sockets into the closing_sockets list
Diffstat (limited to 'Kernel/Net')
-rw-r--r--Kernel/Net/TCPSocket.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp
index f41cfa8812..393d4ac53f 100644
--- a/Kernel/Net/TCPSocket.cpp
+++ b/Kernel/Net/TCPSocket.cpp
@@ -471,8 +471,10 @@ KResult TCPSocket::close()
set_state(State::LastAck);
}
- Locker locker(closing_sockets().lock());
- closing_sockets().resource().set(tuple(), *this);
+ if (state() != State::Closed && state() != State::Listen) {
+ Locker locker(closing_sockets().lock());
+ closing_sockets().resource().set(tuple(), *this);
+ }
return result;
}