From: hackbard Date: Mon, 8 Nov 2004 08:35:23 +0000 (+0000) Subject: send quit message on gui quit + serer recognizes "fucked up" connection now X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=0fbb254a433dd25b5938be009d0835e2c6b17184;p=physik%2Fnlsop.git send quit message on gui quit + serer recognizes "fucked up" connection now --- diff --git a/nlsop_gui.c b/nlsop_gui.c index 8464faf..f2e8c91 100644 --- a/nlsop_gui.c +++ b/nlsop_gui.c @@ -249,6 +249,17 @@ int nothing(t_event *event,void *allineed) { return 1; } +int send_quit(t_net *net) { + + unsigned char data; + + data=GUI_QUIT; + + network_send_chan(net,0,&data,1); + + return 1; +} + int get_command(t_event *event,void *allineed) { t_net *net; @@ -275,6 +286,7 @@ int get_command(t_event *event,void *allineed) { case GUI_QUIT: /* stop everything */ event_math(0,event,READ,REMOVE); + send_quit(net); network_shutdown(net); input_shutdown(input); display_shutdown(display); diff --git a/nlsop_server.c b/nlsop_server.c index 8472491..7f24e8c 100644 --- a/nlsop_server.c +++ b/nlsop_server.c @@ -56,6 +56,7 @@ int *gi; t_net *gnet; t_event *gevent; t_list *gc_list; +t_list *gg_list; int alert; /* @@ -410,7 +411,14 @@ void destroy_it(int signum) { printf("connection to client (ch %d) fucked up!\n",*gi); event_math(gnet->connection[*gi].fd,gevent,READ,REMOVE); network_close(gnet,*gi); - list_del_current(gc_list); + if(list_search_data(gc_list,gi,sizeof(int))==L_SUCCESS) { + list_del_current(gc_list); + printf("removed client from list\n"); + } + if(list_search_data(gg_list,gi,sizeof(int))==L_SUCCESS) { + list_del_current(gg_list); + printf("removed gui from list\n"); + } alert=1; alarm(0); @@ -436,6 +444,7 @@ int main(int argc,char **argv) gnet=&net; gevent=&event; gc_list=&c_list; + gg_list=&g_list; /* tzzz ... */ allyouneed=(void *)addr;