From aa4fdbaaf8fb7d50c78d976fe3018335947c547a Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Thu, 23 Aug 2018 19:41:28 +0900 Subject: dlt-daemon: Fix no state transition to BUFFER state (#65) When epoll detected error for TCP client connection, no state transition had been happened. (Only the file descriptor had been closed) To prevent this, dedicated close function is called according to connection type. Signed-off-by: Yusuke Sato --- src/daemon/dlt_daemon_event_handler.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/daemon/dlt_daemon_event_handler.c b/src/daemon/dlt_daemon_event_handler.c index 9051f07..b0d16dd 100644 --- a/src/daemon/dlt_daemon_event_handler.c +++ b/src/daemon/dlt_daemon_event_handler.c @@ -151,9 +151,21 @@ int dlt_daemon_handle_event(DltEventHandler *pEvent, { /* epoll reports an error, we need to clean-up the concerned event */ - dlt_event_handler_unregister_connection(pEvent, - daemon_local, - fd); + + if (type == DLT_CONNECTION_CLIENT_MSG_TCP) + { + /* To transition to BUFFER state if this is final TCP client connection, + * call dedicated function. this function also calls + * dlt_event_handler_unregister_connection() inside the function. + */ + dlt_daemon_close_socket(fd, daemon, daemon_local, 0); + } + else + { + dlt_event_handler_unregister_connection(pEvent, + daemon_local, + fd); + } continue; } -- cgit v1.2.1