X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=libustcomm%2Fustcomm.c;h=4fe46c537d880d7f9cb27dd13d73c1a660343a3e;hb=3a7b90de71f2a82f73f06fb14a7b77805aea1064;hp=6047b6012bc5f5abb98c45c2e28a4038b6b438a6;hpb=688760ef257bee85e3841e0d27ecf4e2f921ef00;p=ust.git diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index 6047b60..4fe46c5 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -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;