From c6be4affa0b817437e5c11ced065195459818be3 Mon Sep 17 00:00:00 2001 From: Vo Trung Chi Date: Wed, 15 May 2019 16:16:30 +0700 Subject: daemon: Loop for client fds In dlt_daemon_client_send_all_multiple(), while in the loop, the connection to client may be destroyed by recursive call to dlt_daemon_close_socket(). So in some scenario we still use the removed connection, which is unexpected behavior. Solution: loop on the fds array and find the client connection corresponds to. Signed-off-by: Vo Trung Chi --- src/daemon/dlt_daemon_connection.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/daemon/dlt_daemon_connection.c') diff --git a/src/daemon/dlt_daemon_connection.c b/src/daemon/dlt_daemon_connection.c index 456a075..b1a4080 100644 --- a/src/daemon/dlt_daemon_connection.c +++ b/src/daemon/dlt_daemon_connection.c @@ -340,9 +340,6 @@ void dlt_connection_destroy(DltConnection *to_destroy) to_destroy->id = 0; close(to_destroy->receiver->fd); dlt_connection_destroy_receiver(to_destroy); - /* connection pointer might be in poll queue and used even after destroying - * it. To make sure it is not used anymore, connection type is invalidated */ - to_destroy->type = DLT_CONNECTION_TYPE_MAX; free(to_destroy); } -- cgit v1.2.1