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

Comparing gvpe/src/connection.C (file contents):
Revision 1.34 by pcg, Mon May 10 18:57:07 2004 UTC vs.
Revision 1.36 by pcg, Sun May 30 17:36:00 2004 UTC

202// only do action once every x seconds per host whole allowing bursts. 202// only do action once every x seconds per host whole allowing bursts.
203// this implementation ("splay list" ;) is inefficient, 203// this implementation ("splay list" ;) is inefficient,
204// but low on resources. 204// but low on resources.
205struct net_rate_limiter : list<net_rateinfo> 205struct net_rate_limiter : list<net_rateinfo>
206{ 206{
207# define NRL_ALPHA 1. - 1. / 600. // allow bursts 207# define NRL_ALPHA (1. - 1. / 600.) // allow bursts
208# define NRL_CUTOFF 10. // one event every CUTOFF seconds 208# define NRL_CUTOFF 10. // one event every CUTOFF seconds
209# define NRL_EXPIRE NRL_CUTOFF * 30. // expire entries after this time 209# define NRL_EXPIRE (NRL_CUTOFF * 30.) // expire entries after this time
210# define NRL_MAXDIF NRL_CUTOFF * (1. / (1. - NRL_ALPHA)) // maximum diff /count value 210# define NRL_MAXDIF (NRL_CUTOFF * (1. / (1. - NRL_ALPHA))) // maximum diff /count value
211 211
212 bool can (const sockinfo &si) { return can((u32)si.host); } 212 bool can (const sockinfo &si) { return can((u32)si.host); }
213 bool can (u32 host); 213 bool can (u32 host);
214}; 214};
215 215
589{ 589{
590 if (ictx && octx) 590 if (ictx && octx)
591 { 591 {
592 connectmode = conf->connectmode; 592 connectmode = conf->connectmode;
593 593
594 // make sure rekeying timeouts are slightly asymmetric
594 rekey.start (NOW + ::conf.rekey); 595 rekey.start (NOW + ::conf.rekey
596 + (conf->id > THISNODE->id ? 10 : 0));
595 keepalive.start (NOW + ::conf.keepalive); 597 keepalive.start (NOW + ::conf.keepalive);
596 598
597 // send queued packets 599 // send queued packets
598 if (ictx && octx) 600 if (ictx && octx)
599 { 601 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines