projects
/
physik
/
nlsop.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
91008e0
)
send quit message on gui quit + serer recognizes "fucked up" connection now
author
hackbard
<hackbard>
Mon, 8 Nov 2004 08:35:23 +0000
(08:35 +0000)
committer
hackbard
<hackbard>
Mon, 8 Nov 2004 08:35:23 +0000
(08:35 +0000)
nlsop_gui.c
patch
|
blob
|
history
nlsop_server.c
patch
|
blob
|
history
diff --git
a/nlsop_gui.c
b/nlsop_gui.c
index
8464faf
..
f2e8c91
100644
(file)
--- a/
nlsop_gui.c
+++ b/
nlsop_gui.c
@@
-249,6
+249,17
@@
int nothing(t_event *event,void *allineed) {
return 1;
}
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;
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);
case GUI_QUIT:
/* stop everything */
event_math(0,event,READ,REMOVE);
+ send_quit(net);
network_shutdown(net);
input_shutdown(input);
display_shutdown(display);
network_shutdown(net);
input_shutdown(input);
display_shutdown(display);
diff --git
a/nlsop_server.c
b/nlsop_server.c
index
8472491
..
7f24e8c
100644
(file)
--- 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_net *gnet;
t_event *gevent;
t_list *gc_list;
+t_list *gg_list;
int alert;
/*
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);
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);
alert=1;
alarm(0);
@@
-436,6
+444,7
@@
int main(int argc,char **argv)
gnet=&net;
gevent=&event;
gc_list=&c_list;
gnet=&net;
gevent=&event;
gc_list=&c_list;
+ gg_list=&g_list;
/* tzzz ... */
allyouneed=(void *)addr;
/* tzzz ... */
allyouneed=(void *)addr;