fix, unix domain socket code defined in a runtime branch

This commit is contained in:
Basile Burg 2016-02-03 17:01:27 +01:00
parent 9d64081858
commit 3a206f66e3
1 changed files with 6 additions and 2 deletions

View File

@ -209,6 +209,7 @@ bool serverIsRunning(bool useTCP, string socketFile, ushort port)
socket.shutdown(SocketShutdown.BOTH);
socket.close();
}
version(Windows) useTCP = true;
if (useTCP)
{
socket = new TcpSocket(AddressFamily.INET);
@ -216,8 +217,11 @@ bool serverIsRunning(bool useTCP, string socketFile, ushort port)
}
else
{
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
socket.connect(new UnixAddress(socketFile));
version(Windows) {} else
{
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
socket.connect(new UnixAddress(socketFile));
}
}
socket.setOption(SocketOptionLevel.SOCKET, SocketOption.RCVTIMEO, dur!"seconds"(5));
socket.blocking = true;