From 219b0716c0b4bf49aa9bc19558b94e8ac08eb030 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 3 Mar 2016 00:50:09 -0800 Subject: [PATCH 1/4] Documentation updates --- README.md | 15 +++++++++------ man1/dcd-client.1 | 8 +++----- man1/dcd-server.1 | 8 +++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a4ea6a6..42e420c 100644 --- a/README.md +++ b/README.md @@ -63,11 +63,13 @@ the issue.) # Sockets ## TCP On Windows DCD will use TCP sockets to communicate between the client and server. -Other operating systems can use TCP sockets if the client and server use the `--tcp` -command-line switch. +DCD can use TCP sockets on other operating systems if the client and server use +the `--tcp` or `--port` command-line switches. ## UNIX domain sockets Operating systems that support UNIX domain sockets will use them by default. +The path to the socket file can be overriden with the `--socketFile` option. +These are the default paths: #### OSX The socket will be created at `/var/tmp/dcd-${UID}.socket` @@ -75,7 +77,7 @@ The socket will be created at `/var/tmp/dcd-${UID}.socket` #### Linux/BSD The client and server will attempt to create the socket in the following locations: * `${XDG_RUNTIME_DIR}/dcd.socket` -* `/tmp/dcd-${UID}.socket` +* `/tmp/dcd-${UID}.socket` if `XDG_RUNTIME_DIR` is not defined. # Client Because DCD is designed to be used from a text editor, this section is written @@ -214,7 +216,7 @@ in place of a file being edited.) #Server The server must be running for the DCD client to provide autocomplete information. In future versions the client may start the server if it is not running, but for -now it must be started manually or by an editor plugin. +now it must be started manually or (usually) by an editor plugin. ## Configuration Files The server will attempt to read the file ```${XDG_CONFIG_HOME}/dcd/dcd.conf``` @@ -235,7 +237,7 @@ What you actually want is this: /usr/include/dmd/phobos ##Shut down the server -The server can be shut down by running the client with the correct option: +The server can be shut down by running the client with the `--shutdown` option: dcd-client --shutdown @@ -245,4 +247,5 @@ Import directories can be specified on the command line at startup: dcd-server -I/home/user/code/one -I/home/user/code/two ## Port number -The ```--port``` or ```-p``` option lets you specify the port number that the server will listen on. +The ```--port``` or ```-p``` option lets you specify the port number that the +server will listen on. The default port is 9166. diff --git a/man1/dcd-client.1 b/man1/dcd-client.1 index e37e131..7f0affa 100644 --- a/man1/dcd-client.1 +++ b/man1/dcd-client.1 @@ -1,4 +1,4 @@ -.TH dcd-client 1 "Jan 15 2016" "" https://github.com/Hackerpilot/DCD +.TH dcd-client 1 "Mar 3 2016" "" https://github.com/Hackerpilot/DCD .SH NAME dcd-client \- autocompletion client for the D programming language .PD @@ -36,9 +36,7 @@ position is measured in bytes from the beginning of the source code. .RS Choose the port number on which .B dcd-client -listens. This has no effect unless -.B dcd-client -is being run on Windows or the \-\-tcp switch is used. +listens. This switch implies \-\-tcp. .RE .B \-\-tcp .RS @@ -49,7 +47,7 @@ Windows. .I filePath .RS Set the path to use for the UNIX domain socket. Has no effect if the \-\-tcp -switch is used. +or \-\-port switches are used. .RE .B \-I .I directory diff --git a/man1/dcd-server.1 b/man1/dcd-server.1 index 3976d6c..ab132a0 100644 --- a/man1/dcd-server.1 +++ b/man1/dcd-server.1 @@ -1,4 +1,4 @@ -.TH dcd-server 1 "Jan 15 2016" "" https://github.com/Hackerpilot/DCD +.TH dcd-server 1 "Mar 3 2016" "" https://github.com/Hackerpilot/DCD .SH NAME dcd-server \- autocompletion server for the D programming language .PD @@ -22,9 +22,7 @@ dcd-server \- autocompletion server for the D programming language .RS Choose the port number on which .B dcd-server -listens. This has no effect unless -.B dcd-server -is being run on Windows or the \-\-tcp switch is used. +listens. This switch implies \-\-tcp. .RE .B \-\-tcp .RS @@ -35,7 +33,7 @@ Windows. .I filePath .RS Set the path to use for the UNIX domain socket. Has no effect if the \-\-tcp -switch is used. +or \-\-port switches are used. .RE .B \-\-logLevel .I level From eab78141c47b9adb14d520b892e7b53ceebb7a91 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 3 Mar 2016 00:50:48 -0800 Subject: [PATCH 2/4] Fix interaction of --tcp and --port --- src/client/client.d | 10 +++++++++- src/common/socket.d | 2 ++ src/server/server.d | 13 ++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/client/client.d b/src/client/client.d index 7511d9f..5421dec 100644 --- a/src/client/client.d +++ b/src/client/client.d @@ -40,7 +40,7 @@ int main(string[] args) size_t cursorPos = size_t.max; string[] importPaths; - ushort port = 9166; + ushort port; bool help; bool shutdown; bool clearCache; @@ -102,6 +102,14 @@ int main(string[] args) return 1; } + // If the user specified a port number, assume that they wanted a TCP + // connection. Otherwise set the port number to the default and let the + // useTCP flag deterimen what to do later. + if (port != 0) + useTCP = true; + else + port = DEFAULT_PORT_NUMBER; + if (useTCP) socketFile = null; diff --git a/src/common/socket.d b/src/common/socket.d index eed6b40..9fb2528 100644 --- a/src/common/socket.d +++ b/src/common/socket.d @@ -28,6 +28,8 @@ version (linux) version = haveUnixSockets; version (BSD) version = haveUnixSockets; version (FreeBSD) version = haveUnixSockets; +enum DEFAULT_PORT_NUMBER = 9166; + string generateSocketName() { version (haveUnixSockets) diff --git a/src/server/server.d b/src/server/server.d index fa7a32f..f0eac2c 100644 --- a/src/server/server.d +++ b/src/server/server.d @@ -56,7 +56,7 @@ version(OSX) version = useXDG; int main(string[] args) { - ushort port = 9166; + ushort port; bool help; bool printVersion; bool ignoreConfig; @@ -107,6 +107,17 @@ int main(string[] args) return 0; } + // If the user specified a port number, assume that they wanted a TCP + // connection. Otherwise set the port number to the default and let the + // useTCP flag deterimen what to do later. + if (port != 0) + useTCP = true; + else + port = DEFAULT_PORT_NUMBER; + + if (useTCP) + socketFile = null; + version (Windows) if (socketFile !is null) { fatal("UNIX domain sockets not supported on Windows"); From c9be120d5b2f38834e1fc9a6c14026dde8137cdd Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 3 Mar 2016 00:51:01 -0800 Subject: [PATCH 3/4] v0.8.0 --- dub.json | 6 +++--- src/common/dcd_version.d | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dub.json b/dub.json index dccc483..d5f9530 100644 --- a/dub.json +++ b/dub.json @@ -1,14 +1,14 @@ { "name": "dcd", "description": "The D Completion Daemon is an auto-complete program for the D programming language", - "copyright": "Copyright © 2015, Brian Schott", + "copyright": "Copyright © 2015-2016, Brian Schott", "authors": [ "Brian Schott" ], "license": "GPL-3.0", "dependencies": { - "dsymbol": "~>0.1.1", - "libdparse": "~>0.5.0", + "dsymbol": "~>0.1.2", + "libdparse": "~>0.6.0", "msgpack-d": "~>1.0.0-beta.2" }, "versions": ["built_with_dub"], diff --git a/src/common/dcd_version.d b/src/common/dcd_version.d index ac7c229..2d3b77c 100644 --- a/src/common/dcd_version.d +++ b/src/common/dcd_version.d @@ -21,7 +21,7 @@ module common.dcd_version; /** * Human-readable version number */ -enum DCD_VERSION = "v0.8.0-beta2"; +enum DCD_VERSION = "v0.8.0"; version (Windows) {} else version (built_with_dub) {} From f8f3024dda05e7f3d1a112adde1f99ec98649e78 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 3 Mar 2016 00:57:19 -0800 Subject: [PATCH 4/4] Update dependencies --- dsymbol | 2 +- libdparse | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dsymbol b/dsymbol index e07b931..f6aac6c 160000 --- a/dsymbol +++ b/dsymbol @@ -1 +1 @@ -Subproject commit e07b931e04957a2627bfe84c3b198045e8b8041f +Subproject commit f6aac6cab1ffebdc2a56321f0c5fed2c896f38c4 diff --git a/libdparse b/libdparse index 2f91d07..516a053 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit 2f91d07f698545ebc94ede00d5085aa59dbe38b3 +Subproject commit 516a053c9b16d05aee30d2606a88b7f815cd55df