1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Kernel: Convert TCP retransmit queue from HashTable to IntrusiveList

This commit is contained in:
Andreas Kling 2021-08-15 16:37:45 +02:00
parent 7063303022
commit 6a20733fcd
3 changed files with 13 additions and 8 deletions

View file

@ -512,24 +512,24 @@ KResult TCPSocket::close()
return result;
}
static Singleton<ProtectedValue<HashTable<TCPSocket*>>> s_sockets_for_retransmit;
static Singleton<ProtectedValue<TCPSocket::RetransmitList>> s_sockets_for_retransmit;
ProtectedValue<HashTable<TCPSocket*>>& TCPSocket::sockets_for_retransmit()
ProtectedValue<TCPSocket::RetransmitList>& TCPSocket::sockets_for_retransmit()
{
return *s_sockets_for_retransmit;
}
void TCPSocket::enqueue_for_retransmit()
{
sockets_for_retransmit().with_exclusive([&](auto& table) {
table.set(this);
sockets_for_retransmit().with_exclusive([&](auto& list) {
list.append(*this);
});
}
void TCPSocket::dequeue_for_retransmit()
{
sockets_for_retransmit().with_exclusive([&](auto& table) {
table.remove(this);
sockets_for_retransmit().with_exclusive([&](auto& list) {
list.remove(*this);
});
}