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.9 and 1.10

version 1.9, 2007/06/01 01:31:43 version 1.10, 2007/06/01 17:05:38
Line 13 Line 13
 #define snprintf   _snprintf  #define snprintf   _snprintf
 #endif  #endif
   
   #define assert(p) if(!(p)) exit(1)
   
 typedef struct flow {  typedef struct flow {
     int duration;      int duration;
     int weight;      int weight;
Line 23  typedef struct flow { Line 25  typedef struct flow {
 int num, limit;  int num, limit;
 FILE *f = NULL, *s = NULL;  FILE *f = NULL, *s = NULL;
   
   
 void *recvthread(void *arg) {  void *recvthread(void *arg) {
     swaplinks_p swp = (swaplinks_p)arg;      swaplinks_p swp = (swaplinks_p)arg;
     struct sockaddr_ns peer;      struct sockaddr_ns peer;
     socklen_t len = sizeof(peer);      socklen_t len = sizeof(peer);
   flow_t *flows = NULL, *newflow = NULL, *ptr = NULL;    flow_t *flows = NULL, *newflow = NULL, *ptr = NULL, *axe = NULL;
     char tmp[128], buf[2048];      char tmp[128], buf[2048];
     int time = 0, load = 0, delta, expiration;      int time = 0, load = 0, delta, expiration;
   
Line 45  void *recvthread(void *arg) { Line 46  void *recvthread(void *arg) {
             snprintf(buf,2048,"->%d:%d<->",newflow->duration,newflow->weight);              snprintf(buf,2048,"->%d:%d<->",newflow->duration,newflow->weight);
             for(ptr = flows; ptr;) {              for(ptr = flows; ptr;) {
        sprintf(buf,"%s%d:%d<->",buf,ptr->duration,ptr->weight);         sprintf(buf,"%s%d:%d<->",buf,ptr->duration,ptr->weight);
      expiration = 0;       expiration = 0;axe = NULL;
                 if(--ptr->duration == 0) {                  if(--ptr->duration == 0) {
              axe = ptr;
                     load -= ptr->weight;                      load -= ptr->weight;
                     delta -= ptr->weight;                      delta -= ptr->weight;
          if(ptr->last)
            if(ptr->last&& ptr->next) {
       assert(flows != ptr);
       ptr->last->next = ptr->next;        ptr->last->next = ptr->next;
                   else{      ptr->next->last = ptr->last;
            }
            elseif(ptr->next) {
       assert(flows == ptr);
       flows = ptr->next;        flows = ptr->next;
       if(flows) flows->last = NULL;        if(flows) flows->last = NULL;
            }             }
          if(ptr->next)           else if(ptr->last) {
     ptr->next->last = ptr->last;      assert(flows != ptr);
       ptr->last->next = NULL;
            }
            else {
       assert(flows == ptr);
       flows = NULL;
            }
   
          if(s) fprintf(s,"%d EXPIRED FLOW from %s:d%d/w%d\n",num,ptr->source,ptr->duration,ptr->weight);           if(s) fprintf(s,"%d EXPIRED FLOW from %s:d%d/w%d\n",num,ptr->source,ptr->duration,ptr->weight);
            expiration = 1;             expiration = 1;
                 }                  }
        ptr = ptr->next;         ptr = ptr->next;
      if(expiration) free(ptr);       if(expiration) free(axe);
   
             }              }
             sprintf(buf,"%s||\n",buf);              sprintf(buf,"%s||\n",buf);

Removed from v.1.9  
changed lines
  Added in v.1.10


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