Fix IOMode.immediate for Windows sockets to guarantee calling the callback.
This commit is contained in:
parent
e8ed523c08
commit
00b8607fc1
|
@ -552,8 +552,11 @@ final class WinAPIEventDriverSockets : EventDriverSockets {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == IOMode.immediate)
|
if (mode == IOMode.immediate) {
|
||||||
() @trusted { CancelIoEx(cast(HANDLE)cast(SOCKET)socket, cast(LPOVERLAPPED)&slot.read.overlapped); } ();
|
() @trusted { CancelIoEx(cast(HANDLE)cast(SOCKET)socket, cast(LPOVERLAPPED)&slot.read.overlapped); } ();
|
||||||
|
on_read_finish(socket, IOStatus.wouldBlock, 0, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
slot.read.callback = on_read_finish;
|
slot.read.callback = on_read_finish;
|
||||||
addRef(socket);
|
addRef(socket);
|
||||||
|
@ -646,8 +649,11 @@ final class WinAPIEventDriverSockets : EventDriverSockets {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == IOMode.immediate)
|
if (mode == IOMode.immediate) {
|
||||||
() @trusted { CancelIoEx(cast(HANDLE)cast(SOCKET)socket, cast(LPOVERLAPPED)&slot.write.overlapped); } ();
|
() @trusted { CancelIoEx(cast(HANDLE)cast(SOCKET)socket, cast(LPOVERLAPPED)&slot.write.overlapped); } ();
|
||||||
|
on_write_finish(socket, IOStatus.wouldBlock, 0, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
slot.write.callback = on_write_finish;
|
slot.write.callback = on_write_finish;
|
||||||
addRef(socket);
|
addRef(socket);
|
||||||
|
|
Loading…
Reference in a new issue