some more printfs to server + deleted debug printf in gui
[physik/nlsop.git] / nlsop_server.c
index 8472491..085e289 100644 (file)
@@ -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;
 
 /*
@@ -111,6 +112,8 @@ int add_node(t_net *net,t_event *event,t_list *c_list,t_list *g_list) {
   /* if we have a new node - care for it! */
   event_math(net->connection[channel].fd,event,READ,ADD);
 
   /* if we have a new node - care for it! */
   event_math(net->connection[channel].fd,event,READ,ADD);
 
+  printf("\n");
+
   return 1;
 }
 
   return 1;
 }
 
@@ -261,12 +264,14 @@ int handle_node(t_net *net,t_event *event,
           c->status=IDLE;
           /* delete job entry */
           list_del_current(job);
           c->status=IDLE;
           /* delete job entry */
           list_del_current(job);
+          printf("job ended, saved and removed from list.\n");
         }
 
         if(data==DC_OK) {
           save_job(net,i,j,DC_OK);
           /* inc progress state */
           j->progress+=1;
         }
 
         if(data==DC_OK) {
           save_job(net,i,j,DC_OK);
           /* inc progress state */
           j->progress+=1;
+          printf("job at next level, saved.\n");
         }
 
         if(data==DC_QUIT) {
         }
 
         if(data==DC_QUIT) {
@@ -278,6 +283,7 @@ int handle_node(t_net *net,t_event *event,
           list_del_current(c_list);
           /* change job state */
           j->status=IN_QUEUE;
           list_del_current(c_list);
           /* change job state */
           j->status=IN_QUEUE;
+          printf("client terminating, job queued, client removed.\n");
         }
       }
 
         }
       }
 
@@ -307,6 +313,8 @@ int handle_node(t_net *net,t_event *event,
       }
     }
   }
       }
     }
   }
+
+  printf("\n");
    
   return 1;
 }
    
   return 1;
 }
@@ -410,7 +418,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 +451,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;