From 249341bc5838532f99df5c4709a1bd9b9131dcf7 Mon Sep 17 00:00:00 2001 From: default0 Date: Wed, 20 Jan 2016 19:45:29 +0100 Subject: [PATCH] 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. --- src/client/client.d | 11 +++++++++-- src/common/socket.d | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/client/client.d b/src/client/client.d index 515baae..64648c4 100644 --- a/src/client/client.d +++ b/src/client/client.d @@ -312,8 +312,15 @@ Socket createSocket(string socketFile, ushort port) } else { - socket = new Socket(AddressFamily.UNIX, SocketType.STREAM); - socket.connect(new UnixAddress(socketFile)); + version(Windows) + { + throw new Exception("Cannot use UNIX domain sockets on 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; diff --git a/src/common/socket.d b/src/common/socket.d index 05623f6..eed6b40 100644 --- a/src/common/socket.d +++ b/src/common/socket.d @@ -42,4 +42,8 @@ string generateSocketName() "dcd.socket"); } } + else + { + assert(0); + } }