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:
Sönke Ludwig 2020-05-25 14:37:55 +02:00
parent 167745efb0
commit 194667a99f

View file

@ -851,8 +851,12 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
} }
scope src_addrc = new RefAddress(() @trusted { return cast(sockaddr*)&src_addr; } (), src_addr_len); scope src_addrc = new RefAddress(() @trusted { return cast(sockaddr*)&src_addr; } (), src_addr_len);
if (ret == 0) {
on_receive_finish(socket, IOStatus.disconnected, 0, src_addrc);
} else {
on_receive_finish(socket, IOStatus.ok, ret, src_addrc); 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) package void receiveNoGC(DatagramSocketFD socket, ubyte[] buffer, IOMode mode, void delegate(DatagramSocketFD, IOStatus, size_t, scope RefAddress) @safe nothrow @nogc on_receive_finish)
@trusted @nogc { @trusted @nogc {