From: John Ferlito Date: Sat, 13 Sep 2014 01:15:30 +0000 (+1000) Subject: Move sockent_client_disconnect above sockent_client_disconnect so we can use it there X-Git-Tag: collectd-5.5.0~192 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4ce8d9c0203d6360ac19f04ae3c33619058229c8;p=collectd.git Move sockent_client_disconnect above sockent_client_disconnect so we can use it there --- diff --git a/src/network.c b/src/network.c index 0e1ff512..9ad4dead 100644 --- a/src/network.c +++ b/src/network.c @@ -2097,6 +2097,26 @@ static int sockent_init_crypto (sockent_t *se) /* {{{ */ return (0); } /* }}} int sockent_init_crypto */ +static int sockent_client_disconnect (sockent_t *se) /* {{{ */ +{ + struct sockent_client *client; + + if ((se == NULL) || (se->type != SOCKENT_TYPE_CLIENT)) + return (EINVAL); + + client = &se->data.client; + if (client->fd >= 0) /* connected */ + { + close (client->fd); + client->fd = -1; + } + + sfree (client->addr); + client->addrlen = 0; + + return (0); +} /* }}} int sockent_client_disconnect */ + static int sockent_client_connect (sockent_t *se) /* {{{ */ { static c_complain_t complaint = C_COMPLAIN_INIT_STATIC; @@ -2182,26 +2202,6 @@ static int sockent_client_connect (sockent_t *se) /* {{{ */ return (0); } /* }}} int sockent_client_connect */ -static int sockent_client_disconnect (sockent_t *se) /* {{{ */ -{ - struct sockent_client *client; - - if ((se == NULL) || (se->type != SOCKENT_TYPE_CLIENT)) - return (EINVAL); - - client = &se->data.client; - if (client->fd >= 0) /* connected */ - { - close (client->fd); - client->fd = -1; - } - - sfree (client->addr); - client->addrlen = 0; - - return (0); -} /* }}} int sockent_client_disconnect */ - /* Open the file descriptors for a initialized sockent structure. */ static int sockent_server_listen (sockent_t *se) /* {{{ */ {