diff --git a/client.d b/client.d index 5c3469a..cbaa1dd 100644 --- a/client.d +++ b/client.d @@ -225,6 +225,8 @@ AutocompleteResponse getResponse(TcpSocket socket) auto bytesReceived = socket.receive(buffer); if (bytesReceived == Socket.ERROR) throw new Exception("Incorrect number of bytes received"); + if (bytesReceived == 0) + throw new Exception("Server closed the connection, 0 bytes received"); AutocompleteResponse response; msgpack.unpack(buffer[0..bytesReceived], response); return response; diff --git a/server.d b/server.d index f630d45..15b1a62 100644 --- a/server.d +++ b/server.d @@ -157,7 +157,7 @@ int main(string[] args) } if (request.kind & RequestKind.addImport) ModuleCache.addImportPaths(request.importPaths); - else if (request.kind & RequestKind.autocomplete) + if (request.kind & RequestKind.autocomplete) { Log.info("Getting completions"); AutocompleteResponse response = complete(request);