1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Kernel: Lock TCPSocket lookup table across destruction

Use the same trick as SlavePTY and override unref() to provide safe
removal from the sockets_by_tuple table when destroying a TCPSocket.

This should fix the TCPSocket::from_tuple() flake seen on CI.
This commit is contained in:
Andreas Kling 2022-01-06 22:06:00 +01:00
parent 6d7d9dd324
commit 01b3666894
2 changed files with 17 additions and 0 deletions

View file

@ -22,6 +22,8 @@ public:
static ErrorOr<NonnullRefPtr<TCPSocket>> try_create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer);
virtual ~TCPSocket() override;
virtual bool unref() const override;
enum class Direction {
Unspecified,
Outgoing,