X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=libustcomm%2Fustcomm.c;h=cb72db65733eb5353c7d10a74018ff856874c648;hb=69c37f741b8bd8aea95019e1debf5e3bfa9d7fff;hp=60428df0553082bfaa35130b134008743421a202;hpb=2a79ceebcba229c91c93272705444c61c458bb06;p=lttng-ust.git diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index 60428df0..cb72db65 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -421,11 +421,11 @@ int ustcomm_recv_message(struct ustcomm_server *server, char **msg, struct ustco if(retval == 0) { /* connection finished */ - close(fds[idx].fd); - list_for_each_entry(conn, &server->connections, list) { if(conn->fd == fds[idx].fd) { + ustcomm_close_app(conn); list_del(&conn->list); + free(conn); break; } } @@ -503,7 +503,7 @@ static int init_named_socket(const char *name, char **path_out) PERROR("unlink of socket file"); goto close_sock; } - WARN("socket already exists; overwriting"); + DBG("socket already exists; overwriting"); } result = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); @@ -636,7 +636,10 @@ int ustcomm_connect_app(pid_t pid, struct ustcomm_connection *conn) return ustcomm_connect_path(path, conn, pid); } -/* Close a connection to a traceable app. */ +/* Close a connection to a traceable app. It frees the + * resources. It however does not free the + * ustcomm_connection itself. + */ int ustcomm_close_app(struct ustcomm_connection *conn) { @@ -784,11 +787,15 @@ static void ustcomm_fini_server(struct ustcomm_server *server, int keep_socket_f } } +/* Free a traceable application server */ + void ustcomm_fini_app(struct ustcomm_app *handle, int keep_socket_file) { ustcomm_fini_server(&handle->server, keep_socket_file); } +/* Free a ustd server */ + void ustcomm_fini_ustd(struct ustcomm_ustd *handle) { ustcomm_fini_server(&handle->server, 0);