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.1 by pcg, Sat Apr 5 02:32:40 2003 UTC vs.
Revision 1.2 by pcg, Sun Apr 6 18:12:18 2003 UTC

75 vpn_packet *r_pkt; 75 vpn_packet *r_pkt;
76 u32 r_len, r_ofs; 76 u32 r_len, r_ofs;
77 77
78 void tcpv4_ev (io_watcher &w, short revents); 78 void tcpv4_ev (io_watcher &w, short revents);
79 79
80 void send_packet (vpn_packet *pkt, int tos); 80 bool send_packet (vpn_packet *pkt, int tos);
81 81
82 void error (); // abort conenction && cleanup 82 void error (); // abort conenction && cleanup
83 83
84 operator tcp_si_map::value_type() 84 operator tcp_si_map::value_type()
85 { 85 {
128 tcp_si.insert (*i); 128 tcp_si.insert (*i);
129 } 129 }
130 } 130 }
131} 131}
132 132
133void 133bool
134vpn::send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos) 134vpn::send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos)
135{ 135{
136 tcp_si_map::iterator info = tcp_si.find (&si); 136 tcp_si_map::iterator info = tcp_si.find (&si);
137 137
138 tcp_connection *i; 138 tcp_connection *i;
143 tcp_si.insert (*i); 143 tcp_si.insert (*i);
144 } 144 }
145 else 145 else
146 i = info->second; 146 i = info->second;
147 147
148 i->send_packet (pkt, tos); 148 return i->send_packet (pkt, tos);
149} 149}
150 150
151void tcp_connection::error () 151void tcp_connection::error ()
152{ 152{
153 if (fd >= 0) 153 if (fd >= 0)
222 return; 222 return;
223 } 223 }
224 } 224 }
225} 225}
226 226
227void 227bool
228tcp_connection::send_packet (vpn_packet *pkt, int tos) 228tcp_connection::send_packet (vpn_packet *pkt, int tos)
229{ 229{
230 last_activity = NOW; 230 last_activity = NOW;
231 231
232 if (state == IDLE) 232 if (state == IDLE)
267 vec[1].iov_len = pkt->len; 267 vec[1].iov_len = pkt->len;
268 268
269 if (sizeof (u16) + pkt->len != writev (fd, vec, 2)) 269 if (sizeof (u16) + pkt->len != writev (fd, vec, 2))
270 error (); 270 error ();
271 } 271 }
272
273 return state != ERROR;
272} 274}
273 275
274tcp_connection::tcp_connection (int fd_, const sockinfo &si_, vpn &v_) 276tcp_connection::tcp_connection (int fd_, const sockinfo &si_, vpn &v_)
275: v(v_), si(si_), io_watcher(this, &tcp_connection::tcpv4_ev) 277: v(v_), si(si_), io_watcher(this, &tcp_connection::tcpv4_ev)
276{ 278{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines