Kernel: Let pending socket queue keep socket objects alive until accept()

This commit is contained in:
Conrad Pankoff 2019-08-09 12:41:06 +10:00 committed by Andreas Kling
parent 54ceabd48d
commit a53437aa06
Notes: sideshowbarker 2024-07-19 12:48:41 +09:00
2 changed files with 4 additions and 4 deletions

View file

@ -52,7 +52,7 @@ RefPtr<Socket> Socket::accept()
return client;
}
KResult Socket::queue_connection_from(Socket& peer)
KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer)
{
LOCKER(m_lock);
if (m_pending.size() >= m_backlog)

View file

@ -1,9 +1,9 @@
#pragma once
#include <AK/HashTable.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/Vector.h>
#include <Kernel/FileSystem/File.h>
#include <Kernel/KResult.h>
#include <Kernel/Lock.h>
@ -68,7 +68,7 @@ public:
protected:
Socket(int domain, int type, int protocol);
KResult queue_connection_from(Socket&);
KResult queue_connection_from(NonnullRefPtr<Socket>);
void load_receive_deadline();
void load_send_deadline();
@ -95,7 +95,7 @@ private:
timeval m_receive_deadline { 0, 0 };
timeval m_send_deadline { 0, 0 };
Vector<RefPtr<Socket>> m_pending;
NonnullRefPtrVector<Socket> m_pending;
};
class SocketHandle {