From 3a46e013fea05a1b680d70e5d2edbefbf9531ddf Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Sat, 27 May 2017 21:58:13 +0300 Subject: [PATCH] Fix connection closing The client structure was not deleted when the connected application was suddenly terminated (ctrl-c). It was not happening before, so I suspect TCP and UNIX sockets behave differently on this matter. --- src/bin/efl/efl_debugd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/bin/efl/efl_debugd.c b/src/bin/efl/efl_debugd.c index f5881b8..52e10aa 100644 --- a/src/bin/efl/efl_debugd.c +++ b/src/bin/efl/efl_debugd.c @@ -130,7 +130,9 @@ _send(Client *dest, int opcode, void *payload, int payload_size) hdr->thread_id = 0; hdr->opcode = opcode; memcpy(buf + sizeof(Eina_Debug_Packet_Header), payload, payload_size); - //printf("%d bytes sent (opcode %s) to %s fd %d\n", size, _opcodes[opcode]->opcode_string, dest->app_name, dest->fd); + printf("Send packet (size = %d, opcode %s) to %s\n", size, + _opcodes[hdr->opcode]->opcode_string, + dest->app_name); if (send(dest->fd, buf, size, 0) != size) perror("send"); } @@ -404,9 +406,12 @@ _monitor() if (events[i].events & EPOLLHUP) { c = _client_find_by_fd(events[i].data.fd); - printf("Closing client %s/%d\n", c->app_name, c->pid); close(events[i].data.fd); - if (c) _client_del(c); + if (c) + { + printf("Closing client %s/%d\n", c->app_name, c->pid); + _client_del(c); + } } if (events[i].events & EPOLLIN) { @@ -448,6 +453,7 @@ _monitor() // major failure on debug daemon control fd - get out of here. // else goto fail; close(events[i].data.fd); + _client_del(c); //TODO if its not main session we will tell the main_loop //that it disconneted } -- 2.7.4