Kernel: Fix unix domain socket close detection
This commit is contained in:
parent
3a11a5a9a0
commit
f2e41f71d6
|
@ -60,7 +60,10 @@ namespace Kernel
|
|||
{
|
||||
auto& connection_info = m_info.get<ConnectionInfo>();
|
||||
if (auto connection = connection_info.connection.lock(); connection && connection->m_info.has<ConnectionInfo>())
|
||||
{
|
||||
connection->m_info.get<ConnectionInfo>().target_closed = true;
|
||||
connection->m_packet_thread_blocker.unblock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,6 +353,9 @@ namespace Kernel
|
|||
}
|
||||
|
||||
BAN::ErrorOr<size_t> UnixDomainSocket::recvfrom_impl(BAN::ByteSpan buffer, sockaddr*, socklen_t*)
|
||||
{
|
||||
auto state = m_packet_lock.lock();
|
||||
while (m_packet_size_total == 0)
|
||||
{
|
||||
if (m_info.has<ConnectionInfo>())
|
||||
{
|
||||
|
@ -361,9 +367,6 @@ namespace Kernel
|
|||
return BAN::Error::from_errno(ENOTCONN);
|
||||
}
|
||||
|
||||
auto state = m_packet_lock.lock();
|
||||
while (m_packet_size_total == 0)
|
||||
{
|
||||
m_packet_lock.unlock(state);
|
||||
TRY(Thread::current().block_or_eintr_indefinite(m_packet_thread_blocker));
|
||||
state = m_packet_lock.lock();
|
||||
|
|
Loading…
Reference in New Issue