X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=client_common.c;h=8212abb1d611dcff88889fa70629fcdc9f6eb5cf;hp=900d3653893dea7067330d60a929ce0a4b13d902;hb=2b8250e7d8b4bb34727470ee208fc9b725371bec;hpb=72e9bdf7c5c09ca4c20cad56c68a9a155cceff43 diff --git a/client_common.c b/client_common.c index 900d3653..8212abb1 100644 --- a/client_common.c +++ b/client_common.c @@ -32,44 +32,17 @@ /** The size of the receiving buffer. */ #define CLIENT_BUFSIZE 4000 -/** - * Close the connection to para_server and deallocate per-command resources. - * - * \param ct The client task. - * - * This frees all resources of the current command but keeps the configuration - * in \p ct->conf. - * - * \sa \ref client_close(). - */ -void client_disconnect(struct client_task *ct) -{ - if (!ct) - return; - if (ct->scc.fd >= 0) - close(ct->scc.fd); - free_argv(ct->features); - ct->features = NULL; - sc_free(ct->scc.recv); - ct->scc.recv = NULL; - sc_free(ct->scc.send); - ct->scc.send = NULL; - btr_remove_node(&ct->btrn[0]); - btr_remove_node(&ct->btrn[1]); -} - /** * Close the connection to para_server and free all resources. * * \param ct Pointer to the client data. * - * \sa \ref client_open(), \ref client_disconnect(). + * \sa \ref client_open(). */ void client_close(struct client_task *ct) { if (!ct) return; - client_disconnect(ct); free(ct->user); free(ct->config_file); free(ct->key_file); @@ -476,6 +449,16 @@ out: btr_remove_node(&ct->btrn[1]); if (ret != -E_SERVER_CMD_SUCCESS && ret != -E_SERVER_CMD_FAILURE) PARA_ERROR_LOG("%s\n", para_strerror(-ret)); + if (ct->scc.fd >= 0) { + close(ct->scc.fd); + ct->scc.fd = -1; + } + free_argv(ct->features); + ct->features = NULL; + sc_free(ct->scc.recv); + ct->scc.recv = NULL; + sc_free(ct->scc.send); + ct->scc.send = NULL; return ret; }