Fix compiler errors on windows

Checking the repo out and running dub to build on windows would
give two compiler errors, one because UnixAddress is not defined
another because a function misses a return statement if Unix sockets
are not possible.
This commit is contained in:
default0 2016-01-20 19:45:29 +01:00
parent 35e24667f0
commit 249341bc58
2 changed files with 13 additions and 2 deletions

View File

@ -311,10 +311,17 @@ Socket createSocket(string socketFile, ushort port)
socket.connect(new InternetAddress("localhost", port)); socket.connect(new InternetAddress("localhost", port));
} }
else else
{
version(Windows)
{
throw new Exception("Cannot use UNIX domain sockets on 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;
return socket; return socket;

View File

@ -42,4 +42,8 @@ string generateSocketName()
"dcd.socket"); "dcd.socket");
} }
} }
else
{
assert(0);
}
} }