--- gvpe/src/vpn_tcp.C 2007/11/10 05:14:23 1.17 +++ gvpe/src/vpn_tcp.C 2007/11/13 02:12:08 1.19 @@ -1,6 +1,6 @@ /* vpn_tcp.C -- handle the tcp part of the protocol. - Copyright (C) 2003-2005 Marc Lehmann + Copyright (C) 2003-2007 Marc Lehmann This file is part of GVPE. @@ -23,10 +23,10 @@ #if ENABLE_TCP -// tcp processing is extremely ugly, since the vpe protocol is simply +// tcp processing is extremely ugly, since the gvpe protocol is simply // designed for unreliable datagram networks. tcp is implemented by // multiplexing packets over tcp. errors are completely ignored, as we -// rely on the higher level protocol to time out and reconnect. +// rely on the higher level layers to time out and reconnect. #include @@ -65,7 +65,7 @@ tcp_si_map () : cleaner(this, &tcp_si_map::cleaner_cb) { - cleaner.start (300, 300); + cleaner.start (::conf.keepalive / 2, ::conf.keepalive / 2); } } tcp_si; @@ -113,6 +113,7 @@ ++i; else { + delete i->second; erase (i); i = begin (); } @@ -434,6 +435,8 @@ void tcp_connection::error () { + stop (); + if (fd >= 0) { close (fd); @@ -446,16 +449,12 @@ free (proxy_req); proxy_req = 0; #endif - stop (); state = active ? IDLE : ERROR; } tcp_connection::tcp_connection (int fd_, const sockinfo &si_, vpn &v_) : v(v_), si(si_), ev::io(this, &tcp_connection::tcpv4_ev) { - if (!tcp_si.cleaner.active) - tcp_si.cleaner.start (0); - last_activity = ev::ev_now (); r_pkt = 0; w_pkt = 0;