mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
Kernel: Convert TCP retransmit queue from HashTable to IntrusiveList
This commit is contained in:
parent
7063303022
commit
6a20733fcd
|
@ -642,7 +642,7 @@ void retransmit_tcp_packets()
|
|||
// in case retransmit_packets() realizes that it wants to close the socket.
|
||||
NonnullRefPtrVector<TCPSocket, 16> sockets;
|
||||
TCPSocket::sockets_for_retransmit().for_each_shared([&](const auto& socket) {
|
||||
sockets.append(*socket);
|
||||
sockets.append(socket);
|
||||
});
|
||||
|
||||
for (auto& socket : sockets) {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,6 @@ public:
|
|||
void release_to_originator();
|
||||
void release_for_accept(RefPtr<TCPSocket>);
|
||||
|
||||
static ProtectedValue<HashTable<TCPSocket*>>& sockets_for_retransmit();
|
||||
void retransmit_packets();
|
||||
|
||||
virtual KResult close() override;
|
||||
|
@ -222,6 +221,12 @@ private:
|
|||
|
||||
// FIXME: Parse window size TCP option from the peer
|
||||
u32 m_send_window_size { 64 * KiB };
|
||||
|
||||
IntrusiveListNode<TCPSocket> m_retransmit_list_node;
|
||||
|
||||
public:
|
||||
using RetransmitList = IntrusiveList<TCPSocket, RawPtr<TCPSocket>, &TCPSocket::m_retransmit_list_node>;
|
||||
static ProtectedValue<TCPSocket::RetransmitList>& sockets_for_retransmit();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue