This commit is contained in:
Hackerpilot 2016-01-21 15:44:40 -08:00
parent f226487b33
commit d26ce5ed20
2 changed files with 19 additions and 10 deletions

View File

@ -314,7 +314,8 @@ Socket createSocket(string socketFile, ushort port)
{ {
version(Windows) version(Windows)
{ {
throw new Exception("Cannot use UNIX domain sockets on Windows."); // should never be called with non-null socketFile on Windows
assert(false);
} }
else else
{ {

View File

@ -127,6 +127,13 @@ int main(string[] args)
info("Listening on port ", port); info("Listening on port ", port);
} }
else else
{
version(Windows)
{
fatal("UNIX domain sockets not supported on Windows");
return 1;
}
else
{ {
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM); socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
if (exists(socketFile)) if (exists(socketFile))
@ -140,6 +147,7 @@ int main(string[] args)
setAttributes(socketFile, S_IRUSR | S_IWUSR); setAttributes(socketFile, S_IRUSR | S_IWUSR);
info("Listening at ", socketFile); info("Listening at ", socketFile);
} }
}
socket.listen(0); socket.listen(0);
scope (exit) scope (exit)