Merge branch 'master' into allocator_improvements

This commit is contained in:
Hackerpilot 2016-03-03 02:19:51 -08:00
commit 1eae113314
7 changed files with 39 additions and 19 deletions

View File

@ -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.

View File

@ -1,7 +1,7 @@
{
"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"
],

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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");