some more bugfixes + testing
authorhackbard <hackbard>
Wed, 10 Nov 2004 10:43:09 +0000 (10:43 +0000)
committerhackbard <hackbard>
Wed, 10 Nov 2004 10:43:09 +0000 (10:43 +0000)
TODO
nlsop_client.c
nlsop_server.c

diff --git a/TODO b/TODO
index 26ce46b..236442f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,7 @@
 nlsop TODO
 ----------
 
-- more hits per loop (read #hits from trim result)
-- c concentration against depth (a,c,both)
+server,client,gui:
+##################
 
+test & fix!
index 3f76549..535dc89 100644 (file)
@@ -312,21 +312,30 @@ void send_data(int signum) {
   printf("%d <-\n",c);
 
   network_send(gnet->connection[0].fd,&dc,1);
-  /*
+  network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
+  printf("debug: sent dc\n");
+
   network_send(gnet->connection[0].fd,(unsigned char *)gd3_l,
                sizeof(d3_lattice));
+  network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
+  printf("debug: sent d3_lattice\n");
+
   network_send(gnet->connection[0].fd,(unsigned char *)gmy_info,sizeof(info));
-  */
-  printf("debug: sent dc\n");
+  network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
+  printf("debug: sent info\n");
+
   network_send(gnet->connection[0].fd,gd3_l->status,c*sizeof(unsigned char));
   network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
   printf("debug: sent ac\n");
+
   network_send(gnet->connection[0].fd,(unsigned char *)gd3_l->extra,
                c*sizeof(int));
   network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
   printf("debug: sent cc\n");
+
   network_send(gnet->connection[0].fd,(unsigned char *)gi,sizeof(int));
   network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char));
+  printf("debug: sent steps\n");
 
 }
 
index 1fa3135..4f02c1f 100644 (file)
@@ -129,18 +129,25 @@ int save_job(t_net *net,int channel,t_job *job,unsigned char dc) {
   printf("receiving data from client (%d)\n",job->size);
   data=DATA_OK;
 
+  ret=network_receive_chan(net,channel,&d3l,sizeof(d3_lattice));
+  network_send_chan(net,channel,&data,sizeof(unsigned char));
+  printf("debug: got d3_lattice\n");
+
+  ret=network_receive_chan(net,channel,&info,sizeof(info));
+  network_send_chan(net,channel,&data,sizeof(unsigned char));
+  printf("debug: got info\n");
+
   ret=network_receive_chan(net,channel,job->ac,job->size*sizeof(unsigned char));
-  if(ret==N_ERROR) printf("FATAL: getting ac status failed\n");
   network_send_chan(net,channel,&data,sizeof(unsigned char));
   printf("debug: got ac\n");
+
   ret=network_receive_chan(net,channel,(unsigned char *)job->cc,
                            job->size*sizeof(int));
-  if(ret==N_ERROR) printf("FATAL: getting cc failed\n");
   network_send_chan(net,channel,&data,sizeof(unsigned char));
   printf("debug: got cc\n");
+
   ret=network_receive_chan(net,channel,(unsigned char *)&(job->step),
                            sizeof(int));
-  if(ret==N_ERROR) printf("FATAL: getting step number failed\n");
   network_send_chan(net,channel,&data,sizeof(unsigned char));
   printf("debug: got steps\n");
 
@@ -154,16 +161,12 @@ int save_job(t_net *net,int channel,t_job *job,unsigned char dc) {
       return -1;
     }
 
-    memset(&d3l,0,sizeof(d3_lattice));
-    d3l.max_x=job->x;
-    d3l.max_y=job->y;
-    d3l.max_z=job->z;
     if(write(fd,&d3l,sizeof(d3_lattice))<sizeof(d3_lattice)) {
       printf("FATAL: write of d3_lattice failed\n");
       return -1;
     }
 
-    if(write(fd,&(job->info),sizeof(info))<sizeof(info)) {
+    if(write(fd,&info,sizeof(info))<sizeof(info)) {
       printf("FATAL: write of info failed\n");
       return -1;
     }
@@ -278,6 +281,9 @@ int handle_node(t_net *net,t_event *event,
           save_job(net,i,j,DC_END);
           /* reset client */
           c->status=IDLE;
+          /* free job memory */
+          free(j->ac);
+          free(j->cc);
           /* delete job entry */
           list_del_current(job);
           printf("job ended, saved and removed from list.\n");
@@ -371,7 +377,7 @@ int distribute_jobs(t_event *event,void *allineed) {
     if(j->status==IN_QUEUE) count_j++;
   }
   while(list_next(c_list)!=L_NO_NEXT_ELEMENT) {
-    if(j->status==IN_QUEUE) count_j++;
+    c=(t_client *)c_list->current->data;
     if(c->status==IDLE) count_c++;
   }