kernel: Use a did_close callback for UnixSockets
All checks were successful
continuous-integration/drone/pr Build is passing

This commit is contained in:
apio 2023-07-27 19:21:46 +02:00
parent b77b72a551
commit 97d7a7cc6b
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() UnixSocket::~UnixSocket()
{
did_close();
}
void UnixSocket::did_close()
{ {
if (m_peer) if (m_peer)
{ {
m_peer->m_peer = nullptr; m_peer->m_peer = nullptr;
m_peer->m_state = State::Reset; m_peer->m_state = State::Reset;
} }
m_state = State::Inactive;
} }
void UnixSocket::connect_to_peer(UnixSocket* peer) 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> bind(SharedPtr<Socket>, struct sockaddr*, socklen_t) override;
Result<void> connect(struct sockaddr*, socklen_t) override; Result<void> connect(struct sockaddr*, socklen_t) override;
void did_close() override;
void connect_to_peer(UnixSocket* peer); void connect_to_peer(UnixSocket* peer);
virtual ~UnixSocket(); virtual ~UnixSocket();