Log In
New Account
  
 
Home My Page Project Tree Code Snippets Project Openings NUTSS
 
 
Summary Tracker Lists CVS Files
 

CVS | Administration

Diff for /libnutss/examples/slinks_variable_load.c between versions 1.1 and 1.2

version 1.1, 2007/05/28 20:18:20 version 1.2, 2007/05/28 22:05:08
Line 34  void *recvthread(void *arg) { Line 34  void *recvthread(void *arg) {
     while(time < limit) {      while(time < limit) {
         if(swaplinks_recvfrom(swp, tmp, sizeof(tmp), 0, &peer, &len) > 0) {          if(swaplinks_recvfrom(swp, tmp, sizeof(tmp), 0, &peer, &len) > 0) {
             time++;              time++;
           newflow = (flow_t*)malloc(sizeof(flow_t));            newflow = (flow_t*)calloc(1,sizeof(flow_t));
             newflow->duration = atoi(strtok(tmp,";"));              newflow->duration = atoi(strtok(tmp,";"));
             newflow->weight = atoi(strtok(NULL,";"));              newflow->weight = atoi(strtok(NULL,";"));
             fprintf(s,"%d ACCEPTED FLOW from %s: %d/%d\n",num,peer.user+4,newflow->duration,newflow->weight);              fprintf(s,"%d ACCEPTED FLOW from %s: %d/%d\n",num,peer.user+4,newflow->duration,newflow->weight);
             load += newflow->weight;  
             for(ptr = flows; ptr; ptr = ptr->next) {              for(ptr = flows; ptr; ptr = ptr->next) {
                 if(--ptr->duration == 0) {                  if(--ptr->duration == 0) {
                     load -= ptr->weight;                      load -= ptr->weight;
                     if(ptr->last) ptr->last->next = ptr->next;                      if(ptr->last) ptr->last->next = ptr->next;
                     else          flows = ptr->next;                      else          flows = ptr->next;
          if(f) fprintf(f,"-%d\n",ptr->weight);           if(f) fprintf(f,"%d\t%d\t-%d\n",time,load,ptr->weight);
            free(ptr);             free(ptr);
                 }                  }
             }              }
               load += newflow->weight;
             newflow->next = flows;              newflow->next = flows;
             flows = newflow;              flows = newflow;
             if(s) fprintf(s,"Node: %d Time: %d Load: %d\n",num,time,load);              if(s) fprintf(s,"Node: %d Time: %d Load: %d\n",num,time,load);

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
 

GForge.cis.cornell.edu is brought to you by

Cornell Computing and Information Science


Powered By GForge Collaborative Development Environment