int result;
result = send_message_fd(src->fd, msg, NULL);
- if(result) {
+ if(result < 0) {
ERR("error in send_message_fd");
return -1;
}
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;