summaryrefslogtreecommitdiff
path: root/src/bin/efl
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@yahoo.com>2017-05-27 21:58:13 +0300
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2017-06-05 08:55:37 +0300
commit3a46e013fea05a1b680d70e5d2edbefbf9531ddf (patch)
tree29c16bf958992f8e3d08004453785199823c8ef5 /src/bin/efl
parenta466eca4268ee7ff31e652911b3bde2f82a07c74 (diff)
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.
Diffstat (limited to 'src/bin/efl')
-rw-r--r--src/bin/efl/efl_debugd.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bin/efl/efl_debugd.c b/src/bin/efl/efl_debugd.c
index f5881b85ef..52e10aa1be 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)
130 hdr->thread_id = 0; 130 hdr->thread_id = 0;
131 hdr->opcode = opcode; 131 hdr->opcode = opcode;
132 memcpy(buf + sizeof(Eina_Debug_Packet_Header), payload, payload_size); 132 memcpy(buf + sizeof(Eina_Debug_Packet_Header), payload, payload_size);
133 //printf("%d bytes sent (opcode %s) to %s fd %d\n", size, _opcodes[opcode]->opcode_string, dest->app_name, dest->fd); 133 printf("Send packet (size = %d, opcode %s) to %s\n", size,
134 _opcodes[hdr->opcode]->opcode_string,
135 dest->app_name);
134 if (send(dest->fd, buf, size, 0) != size) perror("send"); 136 if (send(dest->fd, buf, size, 0) != size) perror("send");
135} 137}
136 138
@@ -404,9 +406,12 @@ _monitor()
404 if (events[i].events & EPOLLHUP) 406 if (events[i].events & EPOLLHUP)
405 { 407 {
406 c = _client_find_by_fd(events[i].data.fd); 408 c = _client_find_by_fd(events[i].data.fd);
407 printf("Closing client %s/%d\n", c->app_name, c->pid);
408 close(events[i].data.fd); 409 close(events[i].data.fd);
409 if (c) _client_del(c); 410 if (c)
411 {
412 printf("Closing client %s/%d\n", c->app_name, c->pid);
413 _client_del(c);
414 }
410 } 415 }
411 if (events[i].events & EPOLLIN) 416 if (events[i].events & EPOLLIN)
412 { 417 {
@@ -448,6 +453,7 @@ _monitor()
448 // major failure on debug daemon control fd - get out of here. 453 // major failure on debug daemon control fd - get out of here.
449 // else goto fail; 454 // else goto fail;
450 close(events[i].data.fd); 455 close(events[i].data.fd);
456 _client_del(c);
451 //TODO if its not main session we will tell the main_loop 457 //TODO if its not main session we will tell the main_loop
452 //that it disconneted 458 //that it disconneted
453 } 459 }