kernel: Use a did_close callback for UnixSockets

This commit is contained in:
apio 2023-07-27 19:21:46 +02:00
parent fb08594a18
commit 7a7ae086f5
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 8 additions and 0 deletions

View File

@ -11,12 +11,18 @@ UnixSocket::UnixSocket(UnixSocket* peer) : m_state(State::Connected), m_peer(pee
}
UnixSocket::~UnixSocket()
{
did_close();
}
void UnixSocket::did_close()
{
if (m_peer)
{
m_peer->m_peer = nullptr;
m_peer->m_state = State::Reset;
}
m_state = State::Inactive;
}
void UnixSocket::connect_to_peer(UnixSocket* peer)

View File

@ -21,6 +21,8 @@ class UnixSocket : public Socket
Result<void> bind(SharedPtr<Socket>, struct sockaddr*, socklen_t) override;
Result<void> connect(struct sockaddr*, socklen_t) override;
void did_close() override;
void connect_to_peer(UnixSocket* peer);
virtual ~UnixSocket();