fix, unix domain socket code defined in a runtime branch
This commit is contained in:
parent
9d64081858
commit
3a206f66e3
|
@ -209,16 +209,20 @@ bool serverIsRunning(bool useTCP, string socketFile, ushort port)
|
||||||
socket.shutdown(SocketShutdown.BOTH);
|
socket.shutdown(SocketShutdown.BOTH);
|
||||||
socket.close();
|
socket.close();
|
||||||
}
|
}
|
||||||
|
version(Windows) useTCP = true;
|
||||||
if (useTCP)
|
if (useTCP)
|
||||||
{
|
{
|
||||||
socket = new TcpSocket(AddressFamily.INET);
|
socket = new TcpSocket(AddressFamily.INET);
|
||||||
socket.connect(new InternetAddress("localhost", port));
|
socket.connect(new InternetAddress("localhost", port));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
version(Windows) {} else
|
||||||
{
|
{
|
||||||
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
|
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
|
||||||
socket.connect(new UnixAddress(socketFile));
|
socket.connect(new UnixAddress(socketFile));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
socket.setOption(SocketOptionLevel.SOCKET, SocketOption.RCVTIMEO, dur!"seconds"(5));
|
socket.setOption(SocketOptionLevel.SOCKET, SocketOption.RCVTIMEO, dur!"seconds"(5));
|
||||||
socket.blocking = true;
|
socket.blocking = true;
|
||||||
if (sendRequest(socket, request))
|
if (sendRequest(socket, request))
|
||||||
|
|
Loading…
Reference in New Issue