int ret;
d3_lattice d3l;
info info;
+ unsigned char data;
+
+ printf("receiving data from client (%d)\n",job->size);
+ data=DATA_OK;
+
+ network_send_chan(net,channel,&data,sizeof(unsigned char));
+
+ network_receive_chan(net,channel,(unsigned char *)&d3l,
+ sizeof(d3_lattice));
+ network_send_chan(net,channel,&data,sizeof(unsigned char));
+ printf("debug: got d3_lattice\n");
+
+ network_receive_chan(net,channel,(unsigned char *)&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");
- ret=network_receive_chan(net,channel,(unsigned char *)job->cc,
+ network_receive_chan(net,channel,job->ac,job->size*sizeof(unsigned char));
+ network_send_chan(net,channel,&data,sizeof(unsigned char));
+ printf("debug: got ac\n");
+
+ network_receive_chan(net,channel,(unsigned char *)job->cc,
job->size*sizeof(int));
- if(ret==N_ERROR) printf("FATAL: getting cc failed\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 cc\n");
+
+ network_receive_chan(net,channel,(unsigned char *)&(job->step),sizeof(int));
+ network_send_chan(net,channel,&data,sizeof(unsigned char));
+ printf("debug: got steps\n");
if(dc!=DC_QUIT) {
snprintf(filename,128,"./data/nlsop_b%f_c%f_s%f_ds%d_dr%f_-_%d_of_%d.save",
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;
}
if(data==DC_END) {
save_job(net,i,j,DC_END);
/* reset client */
+ printf("client in state %c now\n",c->status&IDLE?'i':'a');
c->status=IDLE;
+ printf("now: %c\n",c->status&IDLE?'i':'a');
+ printf("it is channel %d\n",c->channel);
+ /* 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");
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++;
}
if(min!=0) {
printf("d: distributing jobs ...\n");
- printf("%d queued jobs, %d idle clients\n",count_j,count_c);
+ printf("%d queued jobs, %d idle clients\n\n",count_j,count_c);
}
list_reset(job);
if(data==NLSOP_CJOB) {
network_send_chan(net,c->channel,j->ac,j->size*sizeof(unsigned char));
+ network_receive_chan(net,c->channel,&data,sizeof(unsigned char));
network_send_chan(net,c->channel,(unsigned char *)&(j->cc),
j->size*sizeof(int));
+ network_receive_chan(net,c->channel,&data,sizeof(unsigned char));
+ network_send_chan(net,c->channel,(unsigned char *)&(j->step),sizeof(int));
+ network_receive_chan(net,c->channel,&data,sizeof(unsigned char));
}
--min;