Fix #286
This commit is contained in:
parent
f226487b33
commit
d26ce5ed20
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -128,17 +128,25 @@ int main(string[] args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
|
version(Windows)
|
||||||
if (exists(socketFile))
|
|
||||||
{
|
{
|
||||||
info("Cleaning up old socket file at ", socketFile);
|
fatal("UNIX domain sockets not supported on Windows");
|
||||||
remove(socketFile);
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
|
||||||
|
if (exists(socketFile))
|
||||||
|
{
|
||||||
|
info("Cleaning up old socket file at ", socketFile);
|
||||||
|
remove(socketFile);
|
||||||
|
}
|
||||||
|
socket.blocking = true;
|
||||||
|
socket.setOption(SocketOptionLevel.SOCKET, SocketOption.REUSEADDR, true);
|
||||||
|
socket.bind(new UnixAddress(socketFile));
|
||||||
|
setAttributes(socketFile, S_IRUSR | S_IWUSR);
|
||||||
|
info("Listening at ", socketFile);
|
||||||
}
|
}
|
||||||
socket.blocking = true;
|
|
||||||
socket.setOption(SocketOptionLevel.SOCKET, SocketOption.REUSEADDR, true);
|
|
||||||
socket.bind(new UnixAddress(socketFile));
|
|
||||||
setAttributes(socketFile, S_IRUSR | S_IWUSR);
|
|
||||||
info("Listening at ", socketFile);
|
|
||||||
}
|
}
|
||||||
socket.listen(0);
|
socket.listen(0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue