ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/vpn_dns.C
(Generate patch)

Comparing gvpe/src/vpn_dns.C (file contents):
Revision 1.40 by pcg, Sat Jul 9 20:29:29 2005 UTC vs.
Revision 1.41 by pcg, Wed Nov 22 21:26:41 2006 UTC

771 771
772 // find next packet 772 // find next packet
773 for (vector<dns_rcv *>::iterator i = rcvpq.end (); i-- != rcvpq.begin (); ) 773 for (vector<dns_rcv *>::iterator i = rcvpq.end (); i-- != rcvpq.begin (); )
774 if (SEQNO_EQ (rcvseq, (*i)->seqno)) 774 if (SEQNO_EQ (rcvseq, (*i)->seqno))
775 { 775 {
776 //printf ("seqno eq %x %x\n", rcvseq, (*i)->seqno);//D
776 // enter the packet into our input stream 777 // enter the packet into our input stream
777 r = *i; 778 r = *i;
778 779
779 // remove the oldest packet, look forward, as it's oldest first 780 // remove the oldest packet, look forward, as it's oldest first
780 for (vector<dns_rcv *>::iterator j = rcvpq.begin (); j != rcvpq.end (); ++j) 781 for (vector<dns_rcv *>::iterator j = rcvpq.begin (); j != rcvpq.end (); ++j)
781 if (SEQNO_EQ ((*j)->seqno, rcvseq - MAX_WINDOW)) 782 if (SEQNO_EQ ((*j)->seqno, rcvseq - MAX_WINDOW))
782 { 783 {
784 //printf ("seqno RR %x %x\n", (*j)->seqno, rcvseq - MAX_WINDOW);//D
783 delete *j; 785 delete *j;
784 rcvpq.erase (j); 786 rcvpq.erase (j);
785 break; 787 break;
786 } 788 }
787 789
1015 { 1017 {
1016 dns_connection *dns = (*i)->dns; 1018 dns_connection *dns = (*i)->dns;
1017 connection *c = dns->c; 1019 connection *c = dns->c;
1018 int seqno = (*i)->seqno; 1020 int seqno = (*i)->seqno;
1019 u8 data[MAXSIZE], *datap = data; 1021 u8 data[MAXSIZE], *datap = data;
1022 //printf ("rcv pkt %x\n", seqno);//D
1020 1023
1021 if ((*i)->retry) 1024 if ((*i)->retry)
1022 { 1025 {
1023 dns->send_interval *= 1.01; 1026 dns->send_interval *= 1.01;
1024 if (dns->send_interval > MAX_SEND_INTERVAL) 1027 if (dns->send_interval > MAX_SEND_INTERVAL)
1230 { 1233 {
1231 send = r; 1234 send = r;
1232 1235
1233 r->retry++; 1236 r->retry++;
1234 r->timeout = NOW + (r->retry * min_latency * conf.dns_timeout_factor); 1237 r->timeout = NOW + (r->retry * min_latency * conf.dns_timeout_factor);
1238 //printf ("RETRY %x (%d, %f)\n", r->seqno, r->retry, r->timeout - NOW);//D
1235 1239
1236 // the following code changes the query section a bit, forcing 1240 // the following code changes the query section a bit, forcing
1237 // the forwarder to generate a new request 1241 // the forwarder to generate a new request
1238 if (r->stdhdr) 1242 if (r->stdhdr)
1239 {
1240 //printf ("reencoded header for ID %d retry %d:%d:%d (%p)\n", htons (r->pkt->id), THISNODE->id, r->seqno, r->retry);
1241 //encode_header ((char *)r->pkt->at (6 * 2 + 1), THISNODE->id, r->seqno, r->retry); 1243 encode_header ((char *)r->pkt->at (6 * 2 + 1), THISNODE->id, r->seqno, r->retry);
1242 }
1243 } 1244 }
1244 } 1245 }
1245 else 1246 else
1246 NEXT (r->timeout); 1247 NEXT (r->timeout);
1247 } 1248 }
1273 } 1274 }
1274 1275
1275 send = new dns_snd (this); 1276 send = new dns_snd (this);
1276 send->gen_stream_req (sndseq, snddq); 1277 send->gen_stream_req (sndseq, snddq);
1277 send->timeout = NOW + min_latency * conf.dns_timeout_factor; 1278 send->timeout = NOW + min_latency * conf.dns_timeout_factor;
1279 //printf ("SEND %x (%f)\n", send->seqno, send->timeout - NOW, min_latency, conf.dns_timeout_factor);//D
1278 1280
1279 sndseq = (sndseq + 1) & SEQNO_MASK; 1281 sndseq = (sndseq + 1) & SEQNO_MASK;
1280 } 1282 }
1281 else 1283 else
1282 NEXT (last_sent + send_interval); 1284 NEXT (last_sent + send_interval);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines