fix setKeepAliveParams on Windows
This commit is contained in:
parent
322438697c
commit
a2d96f1831
|
@ -8,6 +8,8 @@ import eventcore.internal.win32;
|
|||
import eventcore.internal.utils : AlgebraicChoppedVector, print, nogc_assert;
|
||||
import std.socket : Address;
|
||||
|
||||
import core.time: Duration;
|
||||
|
||||
private enum WM_USER_SOCKET = WM_USER + 1;
|
||||
|
||||
|
||||
|
@ -225,7 +227,8 @@ final class WinAPIEventDriverSockets : EventDriverSockets {
|
|||
{
|
||||
tcp_keepalive opts = tcp_keepalive(1, cast(ulong) idle.total!"msecs"(),
|
||||
cast(ulong) interval.total!"msecs");
|
||||
int result = WSAIoctl(socket, SIO_KEEPALIVE_VALS, &opts, tcp_keepalive.sizeof, null, 0, null, null);
|
||||
int result = WSAIoctl(socket, SIO_KEEPALIVE_VALS, &opts, cast(uint) tcp_keepalive.sizeof,
|
||||
null, 0, null, null, null);
|
||||
if (result != 0)
|
||||
{
|
||||
print("WSAIoctl SIO_KEEPALIVE_VALS returned %d", result);
|
||||
|
|
|
@ -112,18 +112,18 @@ struct tcp_keepalive {
|
|||
};
|
||||
|
||||
// https://gist.github.com/piscisaureus/906386#file-winsock2-h-L1099
|
||||
enum : ulong {
|
||||
enum : DWORD {
|
||||
IOC_VENDOR = 0x18000000,
|
||||
IOC_OUT = 0x40000000,
|
||||
IOC_IN = 0x80000000
|
||||
}
|
||||
|
||||
ulong _WSAIOW(ulong x, ulong y) pure @safe
|
||||
DWORD _WSAIOW(DWORD x, DWORD y) pure @safe
|
||||
{
|
||||
return IOC_IN | x | y;
|
||||
}
|
||||
|
||||
enum : ulong {
|
||||
enum : DWORD {
|
||||
SIO_KEEPALIVE_VALS = _WSAIOW(IOC_VENDOR, 4)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue