Fix reported status for disconnected message based Unix sockets.
Was reporting IOStatus.ok for a connection that was disconnected, possibly resulting in an endless loop (or recursion) of trying to read another (apparently zero sized) packet.
This commit is contained in:
parent
167745efb0
commit
194667a99f
|
@ -851,7 +851,11 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
|
|||
}
|
||||
|
||||
scope src_addrc = new RefAddress(() @trusted { return cast(sockaddr*)&src_addr; } (), src_addr_len);
|
||||
on_receive_finish(socket, IOStatus.ok, ret, src_addrc);
|
||||
if (ret == 0) {
|
||||
on_receive_finish(socket, IOStatus.disconnected, 0, src_addrc);
|
||||
} else {
|
||||
on_receive_finish(socket, IOStatus.ok, ret, src_addrc);
|
||||
}
|
||||
}
|
||||
|
||||
package void receiveNoGC(DatagramSocketFD socket, ubyte[] buffer, IOMode mode, void delegate(DatagramSocketFD, IOStatus, size_t, scope RefAddress) @safe nothrow @nogc on_receive_finish)
|
||||
|
|
Loading…
Reference in a new issue