/[pkg-mixmaster]/trunk/Mix/Src/chain.c
ViewVC logotype

Diff of /trunk/Mix/Src/chain.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 502 by weaselp, Sat May 3 06:15:09 2003 UTC revision 509 by weaselp, Mon May 5 10:53:00 2003 UTC
# Line 6  Line 6 
6     details.     details.
7    
8     Prepare messages for remailer chain     Prepare messages for remailer chain
9     $Id: chain.c,v 1.10 2003/05/03 06:15:09 weaselp Exp $ */     $Id: chain.c,v 1.11 2003/05/05 10:53:00 weaselp Exp $ */
10    
11    
12  #include "mix3.h"  #include "mix3.h"
# Line 86  void parse_badchains(int badchains[MAXRE Line 86  void parse_badchains(int badchains[MAXRE
86        badchains[lefti][righti] = 1;        badchains[lefti][righti] = 1;
87      }      }
88    }    }
89      /* If some broken chain includes all remailers (*) mark it broken for
90       * every single remailer - this simplifies handling in other places */
91      for (i=1; i < maxrem; i++ ) {
92        if (badchains[0][i])
93          for (j=1; j < maxrem; j++ )
94            badchains[j][i] = 1;
95        if (badchains[i][0])
96          for (j=1; j < maxrem; j++ )
97            badchains[i][j] = 1;
98      }
99    fclose(list);    fclose(list);
100  }  }
101    
# Line 190  int chain_randfinal(int type, REMAILER * Line 200  int chain_randfinal(int type, REMAILER *
200          (type == MSG_NULL || !remailer[i].flags.middle) &&   /* remailer is not middleman */          (type == MSG_NULL || !remailer[i].flags.middle) &&   /* remailer is not middleman */
201          !remailer[i].flags.star_ex &&                        /* remailer is not excluded from random selection */          !remailer[i].flags.star_ex &&                        /* remailer is not excluded from random selection */
202          (remailer[i].flags.post || type != MSG_POST) &&      /* remailer supports post when this is a post */          (remailer[i].flags.post || type != MSG_POST) &&      /* remailer supports post when this is a post */
203          ((secondtolasthop == -1) ||          ((secondtolasthop == -1) || !badchains[secondtolasthop][i]);
204             (!badchains[secondtolasthop][i] &&                                       /* we only have hop or the previous one can send to this (may be random) */
             !badchains[secondtolasthop][0] &&  
             !badchains[0][i]));/* we only have hop or the previous one can send to this (may be random) */  
205      num += select[i];      num += select[i];
206    }    }
207    if (num == 0)    if (num == 0)
# Line 234  int chain_rand(REMAILER *remailer, int b Line 242  int chain_rand(REMAILER *remailer, int b
242            !remailer[i].flags.star_ex &&                          /* remailer is not excluded from random selection */            !remailer[i].flags.star_ex &&                          /* remailer is not excluded from random selection */
243            remailer[i].info[t].latency <= MAXLAT &&               /* remailer has small enough latency */            remailer[i].info[t].latency <= MAXLAT &&               /* remailer has small enough latency */
244            !badchains[i][0] && !badchains[i][thischain[hop-1]] && /* remailer can send to the next one */            !badchains[i][0] && !badchains[i][thischain[hop-1]] && /* remailer can send to the next one */
245                                !badchains[0][thischain[hop-1]] &&            (hop == chainlen-1 || !badchains[thischain[hop+1]][i]);
246            (hop == chainlen-1 ||                                     /* we are at the first hop or the previous one can send to this (may be random) */
              ( !badchains[thischain[hop+1]][i] &&  
                !badchains[thischain[hop+1]][0] &&  
                !badchains[0][i] ));/* we are at the first hop or the previous one can send to this (may be random) */  
247          randavail += select[i];          randavail += select[i];
248        }        }
249    

Legend:
Removed from v.502  
changed lines
  Added in v.509

  ViewVC Help
Powered by ViewVC 1.1.5