diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-02 11:24:02 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-02 11:24:02 -0300 |
commit | cab8cf970c09ea465d30e11eb356e2e5d37dc544 (patch) | |
tree | 5d274c892e4d53f5e976ae8f6f58aba030785e02 /src/nvim/os/server.c | |
parent | 52a9a5b0b0c53a1481d901f39ed0d1e7e86c3853 (diff) | |
parent | 4aecb71b0e819aa84a430dacdab2146229c410a5 (diff) | |
download | rneovim-cab8cf970c09ea465d30e11eb356e2e5d37dc544.tar.gz rneovim-cab8cf970c09ea465d30e11eb356e2e5d37dc544.tar.bz2 rneovim-cab8cf970c09ea465d30e11eb356e2e5d37dc544.zip |
Merge pull request #710 'Automatically generate declarations'
Diffstat (limited to 'src/nvim/os/server.c')
-rw-r--r-- | src/nvim/os/server.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/nvim/os/server.c b/src/nvim/os/server.c index 4aac2babc6..b5d8d8af64 100644 --- a/src/nvim/os/server.c +++ b/src/nvim/os/server.c @@ -42,10 +42,11 @@ typedef struct { static PMap(cstr_t) *servers = NULL; -static void connection_cb(uv_stream_t *server, int status); -static void free_client(uv_handle_t *handle); -static void free_server(uv_handle_t *handle); +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "os/server.c.generated.h" +#endif +/// Initializes the module void server_init() { servers = pmap_new(cstr_t)(); @@ -59,6 +60,7 @@ void server_init() server_start((char *)os_getenv("NEOVIM_LISTEN_ADDRESS")); } +/// Teardown the server module void server_teardown() { if (!servers) { @@ -76,6 +78,15 @@ void server_teardown() }); } +/// Starts listening on arbitrary tcp/unix addresses specified by +/// `endpoint` for API calls. The type of socket used(tcp or unix/pipe) will +/// be determined by parsing `endpoint`: If it's a valid tcp address in the +/// 'ip:port' format, then it will be tcp socket, else it will be a unix +/// socket or named pipe. +/// +/// @param endpoint Address of the server. Either a 'ip:port' string or an +/// arbitrary identifier(trimmed to 256 bytes) for the unix socket or +/// named pipe. void server_start(char *endpoint) { char addr[ADDRESS_MAX_SIZE]; @@ -175,6 +186,9 @@ void server_start(char *endpoint) pmap_put(cstr_t)(servers, addr, server); } +/// Stops listening on the address specified by `endpoint`. +/// +/// @param endpoint Address of the server. void server_stop(char *endpoint) { Server *server; |