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

Comparing gvpe/src/vpn_tcp.C (file contents):
Revision 1.26 by pcg, Thu Aug 7 17:54:27 2008 UTC vs.
Revision 1.27 by root, Tue Feb 8 23:11:36 2011 UTC

77 { 77 {
78 ev_default_loop (0); 78 ev_default_loop (0);
79 cleaner.set<tcp_si_map, &tcp_si_map::cleaner_cb> (this); 79 cleaner.set<tcp_si_map, &tcp_si_map::cleaner_cb> (this);
80 cleaner.start (::conf.keepalive / 2, ::conf.keepalive / 2); 80 cleaner.start (::conf.keepalive / 2, ::conf.keepalive / 2);
81 } 81 }
82};
82 83
83} tcp_si; 84static tcp_si_map tcp_si;
84 85
85struct tcp_connection : ev::io 86struct tcp_connection : ev::io
86{ 87{
87 int tos; 88 int tos;
88 tstamp last_activity; 89 tstamp last_activity;
116 117
117 tcp_connection (int fd_, const sockinfo &si_, vpn &v_); 118 tcp_connection (int fd_, const sockinfo &si_, vpn &v_);
118 ~tcp_connection (); 119 ~tcp_connection ();
119}; 120};
120 121
122void
121void tcp_si_map::cleaner_cb (ev::timer &w, int revents) 123tcp_si_map::cleaner_cb (ev::timer &w, int revents)
122{ 124{
123 tstamp to = ev_now () - ::conf.keepalive - 30 - 60; 125 tstamp to = ev_now () - ::conf.keepalive - 30 - 60;
124 126
125 for (iterator i = begin (); i != end(); ) 127 for (iterator i = begin (); i != end(); )
126 if (i->second->last_activity >= to) 128 if (i->second->last_activity >= to)
449 } 451 }
450 452
451 return state != ERROR; 453 return state != ERROR;
452} 454}
453 455
456void
454void tcp_connection::error () 457tcp_connection::error ()
455{ 458{
456 stop (); 459 stop ();
457 460
458 if (fd >= 0) 461 if (fd >= 0)
459 { 462 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines