ust: make lttd work
[ust.git] / libustcomm / ustcomm.c
index 6047b6012bc5f5abb98c45c2e28a4038b6b438a6..4fe46c537d880d7f9cb27dd13d73c1a660343a3e 100644 (file)
@@ -201,7 +201,7 @@ int ustcomm_send_reply(struct ustcomm_server *server, char *msg, struct ustcomm_
        int result;
 
        result = send_message_fd(src->fd, msg, NULL);
-       if(result) {
+       if(result < 0) {
                ERR("error in send_message_fd");
                return -1;
        }
@@ -316,6 +316,26 @@ int ustcomm_app_recv_message(struct ustcomm_app *app, char **msg, struct ustcomm
        return ustcomm_recv_message(&app->server, msg, src, timeout);
 }
 
+/* This removes src from the list of active connections of app.
+ */
+
+int ustcomm_app_detach_client(struct ustcomm_app *app, struct ustcomm_source *src)
+{
+       struct ustcomm_server *server = (struct ustcomm_server *)app;
+       struct ustcomm_connection *conn;
+
+       list_for_each_entry(conn, &server->connections, list) {
+               if(conn->fd == src->fd) {
+                       list_del(&conn->list);
+                       goto found;
+               }
+       }
+
+       return -1;
+found:
+       return src->fd;
+}
+
 static int init_named_socket(char *name, char **path_out)
 {
        int result;
This page took 0.0228930000000001 seconds and 4 git commands to generate.