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

Comparing gvpe/src/protocol.C (file contents):
Revision 1.4 by pcg, Thu Mar 6 18:43:07 2003 UTC vs.
Revision 1.5 by pcg, Sat Mar 8 10:48:41 2003 UTC

559} 559}
560 560
561void 561void
562connection::establish_connection () 562connection::establish_connection ()
563{ 563{
564 if (!ictx && conf != THISNODE && conf->connectmode != conf_node::C_NEVER) 564 if (!ictx && conf != THISNODE && connectmode != conf_node::C_NEVER)
565 { 565 {
566 if (now >= next_retry) 566 if (now >= next_retry)
567 { 567 {
568 int retry_int = retry_cnt & 3 ? (retry_cnt & 3) : 1 << (retry_cnt >> 2); 568 int retry_int = retry_cnt & 3 ? (retry_cnt & 3) : 1 << (retry_cnt >> 2);
569 569
570 if (retry_cnt < (17 << 2) | 3) 570 if (retry_cnt < (17 << 2) | 3)
571 retry_cnt++; 571 retry_cnt++;
572 572
573 if (conf->connectmode == conf_node::C_ONDEMAND 573 if (connectmode == conf_node::C_ONDEMAND
574 && retry_int > ::conf.keepalive) 574 && retry_int > ::conf.keepalive)
575 retry_int = ::conf.keepalive; 575 retry_int = ::conf.keepalive;
576 576
577 next_retry = now + retry_int; 577 next_retry = now + retry_int;
578 next_wakeup (next_retry); 578 next_wakeup (next_retry);
692 { 692 {
693 reset_connection (); 693 reset_connection ();
694 694
695 config_packet *p = (config_packet *) pkt; 695 config_packet *p = (config_packet *) pkt;
696 if (p->chk_config ()) 696 if (p->chk_config ())
697 if (conf->connectmode == conf_node::C_ALWAYS) 697 if (connectmode == conf_node::C_ALWAYS)
698 establish_connection (); 698 establish_connection ();
699 699
700 //D slog the protocol mismatch? 700 //D slog the protocol mismatch?
701 } 701 }
702 break; 702 break;
781 while (tap_packet *p = queue.get ()) 781 while (tap_packet *p = queue.get ())
782 { 782 {
783 send_data_packet (p); 783 send_data_packet (p);
784 delete p; 784 delete p;
785 } 785 }
786
787 connectmode = conf->connectmode;
786 788
787 slog (L_INFO, _("connection to %d (%s %s) established"), 789 slog (L_INFO, _("connection to %d (%s %s) established"),
788 conf->id, conf->nodename, (const char *)sockinfo (ssa)); 790 conf->id, conf->nodename, (const char *)sockinfo (ssa));
789 791
790 if (::conf.script_node_up) 792 if (::conf.script_node_up)
949 951
950void connection::timer () 952void connection::timer ()
951{ 953{
952 if (conf != THISNODE) 954 if (conf != THISNODE)
953 { 955 {
954 if (now >= next_retry && conf->connectmode == conf_node::C_ALWAYS) 956 if (now >= next_retry && connectmode == conf_node::C_ALWAYS)
955 establish_connection (); 957 establish_connection ();
956 958
957 if (ictx && octx) 959 if (ictx && octx)
958 { 960 {
959 if (now >= next_rekey) 961 if (now >= next_rekey)
1121 connection *conn = new connection (this); 1123 connection *conn = new connection (this);
1122 1124
1123 conn->conf = *i; 1125 conn->conf = *i;
1124 conns.push_back (conn); 1126 conns.push_back (conn);
1125 1127
1126 if (conn->conf->connectmode == conf_node::C_ALWAYS)
1127 conn->establish_connection (); 1128 conn->establish_connection ();
1128 } 1129 }
1129} 1130}
1130 1131
1131connection *vpn::find_router () 1132connection *vpn::find_router ()
1132{ 1133{
1136 for (conns_vector::iterator i = conns.begin (); i != conns.end (); ++i) 1137 for (conns_vector::iterator i = conns.begin (); i != conns.end (); ++i)
1137 { 1138 {
1138 connection *c = *i; 1139 connection *c = *i;
1139 1140
1140 if (c->conf->routerprio > prio 1141 if (c->conf->routerprio > prio
1141 && c->conf->connectmode == conf_node::C_ALWAYS 1142 && c->connectmode == conf_node::C_ALWAYS
1142 && c->conf != THISNODE 1143 && c->conf != THISNODE
1143 && c->ictx && c->octx) 1144 && c->ictx && c->octx)
1144 { 1145 {
1145 prio = c->conf->routerprio; 1146 prio = c->conf->routerprio;
1146 router = c; 1147 router = c;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines