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.3 by pcg, Wed Apr 2 05:15:00 2003 UTC vs.
Revision 1.4 by pcg, Wed Apr 2 21:02:25 2003 UTC

85 rsachallenge chg; 85 rsachallenge chg;
86}; 86};
87 87
88struct rsa_cache : list<rsa_entry> 88struct rsa_cache : list<rsa_entry>
89{ 89{
90 void cleaner_cb (tstamp &ts); time_watcher cleaner; 90 void cleaner_cb (time_watcher &w); time_watcher cleaner;
91 91
92 bool find (const rsaid &id, rsachallenge &chg) 92 bool find (const rsaid &id, rsachallenge &chg)
93 { 93 {
94 for (iterator i = begin (); i != end (); ++i) 94 for (iterator i = begin (); i != end (); ++i)
95 { 95 {
129 : cleaner (this, &rsa_cache::cleaner_cb) 129 : cleaner (this, &rsa_cache::cleaner_cb)
130 { } 130 { }
131 131
132} rsa_cache; 132} rsa_cache;
133 133
134void rsa_cache::cleaner_cb (tstamp &ts) 134void rsa_cache::cleaner_cb (time_watcher &w)
135{ 135{
136 if (empty ()) 136 if (empty ())
137 ts = TSTAMP_CANCEL; 137 w.at = TSTAMP_CANCEL;
138 else 138 else
139 { 139 {
140 ts = NOW + RSA_TTL; 140 w.at = NOW + RSA_TTL;
141 141
142 for (iterator i = begin (); i != end (); ) 142 for (iterator i = begin (); i != end (); )
143 if (i->expire <= NOW) 143 if (i->expire <= NOW)
144 i = erase (i); 144 i = erase (i);
145 else 145 else
641 641
642 delete r; 642 delete r;
643} 643}
644 644
645void 645void
646connection::establish_connection_cb (tstamp &ts) 646connection::establish_connection_cb (time_watcher &w)
647{ 647{
648 if (ictx || conf == THISNODE 648 if (ictx || conf == THISNODE
649 || connectmode == conf_node::C_NEVER 649 || connectmode == conf_node::C_NEVER
650 || connectmode == conf_node::C_DISABLED) 650 || connectmode == conf_node::C_DISABLED)
651 ts = TSTAMP_CANCEL; 651 w.at = TSTAMP_CANCEL;
652 else if (ts <= NOW) 652 else if (w.at <= NOW)
653 { 653 {
654 double retry_int = double (retry_cnt & 3 ? (retry_cnt & 3) : 1 << (retry_cnt >> 2)) * 0.6; 654 double retry_int = double (retry_cnt & 3 ? (retry_cnt & 3) : 1 << (retry_cnt >> 2)) * 0.6;
655 655
656 if (retry_int < 3600 * 8) 656 if (retry_int < 3600 * 8)
657 retry_cnt++; 657 retry_cnt++;
658 658
659 ts = NOW + retry_int; 659 w.at = NOW + retry_int;
660 660
661 if (conf->hostname) 661 if (conf->hostname)
662 { 662 {
663 reset_dstaddr (); 663 reset_dstaddr ();
664 if (si.host && auth_rate_limiter.can (si)) 664 if (si.host && auth_rate_limiter.can (si))
707 707
708 reset_connection (); 708 reset_connection ();
709} 709}
710 710
711void 711void
712connection::rekey_cb (tstamp &ts) 712connection::rekey_cb (time_watcher &w)
713{ 713{
714 ts = TSTAMP_CANCEL; 714 w.at = TSTAMP_CANCEL;
715 715
716 reset_connection (); 716 reset_connection ();
717 establish_connection (); 717 establish_connection ();
718} 718}
719 719
1016 send_reset (rsi); 1016 send_reset (rsi);
1017 break; 1017 break;
1018 } 1018 }
1019} 1019}
1020 1020
1021void connection::keepalive_cb (tstamp &ts) 1021void connection::keepalive_cb (time_watcher &w)
1022{ 1022{
1023 if (NOW >= last_activity + ::conf.keepalive + 30) 1023 if (NOW >= last_activity + ::conf.keepalive + 30)
1024 { 1024 {
1025 reset_connection (); 1025 reset_connection ();
1026 establish_connection (); 1026 establish_connection ();
1027 } 1027 }
1028 else if (NOW < last_activity + ::conf.keepalive) 1028 else if (NOW < last_activity + ::conf.keepalive)
1029 ts = last_activity + ::conf.keepalive; 1029 w.at = last_activity + ::conf.keepalive;
1030 else if (conf->connectmode != conf_node::C_ONDEMAND 1030 else if (conf->connectmode != conf_node::C_ONDEMAND
1031 || THISNODE->connectmode != conf_node::C_ONDEMAND) 1031 || THISNODE->connectmode != conf_node::C_ONDEMAND)
1032 { 1032 {
1033 send_ping (si); 1033 send_ping (si);
1034 ts = NOW + 5; 1034 w.at = NOW + 5;
1035 } 1035 }
1036 else 1036 else
1037 reset_connection (); 1037 reset_connection ();
1038} 1038}
1039 1039

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines