1 | /* |
1 | /* |
2 | vpn_tcp.C -- handle the tcp part of the protocol. |
2 | vpn_tcp.C -- handle the tcp part of the protocol. |
3 | Copyright (C) 2003-2005 Marc Lehmann <gvpe@schmorp.de> |
3 | Copyright (C) 2003-2007 Marc Lehmann <gvpe@schmorp.de> |
4 | |
4 | |
5 | This file is part of GVPE. |
5 | This file is part of GVPE. |
6 | |
6 | |
7 | GVPE is free software; you can redistribute it and/or modify |
7 | GVPE is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
8 | it under the terms of the GNU General Public License as published by |
… | |
… | |
432 | return state != ERROR; |
432 | return state != ERROR; |
433 | } |
433 | } |
434 | |
434 | |
435 | void tcp_connection::error () |
435 | void tcp_connection::error () |
436 | { |
436 | { |
|
|
437 | stop (); |
|
|
438 | |
437 | if (fd >= 0) |
439 | if (fd >= 0) |
438 | { |
440 | { |
439 | close (fd); |
441 | close (fd); |
440 | fd = -1; |
442 | fd = -1; |
441 | } |
443 | } |
… | |
… | |
444 | delete w_pkt; w_pkt = 0; |
446 | delete w_pkt; w_pkt = 0; |
445 | #if ENABLE_HTTP_PROXY |
447 | #if ENABLE_HTTP_PROXY |
446 | free (proxy_req); proxy_req = 0; |
448 | free (proxy_req); proxy_req = 0; |
447 | #endif |
449 | #endif |
448 | |
450 | |
449 | stop (); |
|
|
450 | state = active ? IDLE : ERROR; |
451 | state = active ? IDLE : ERROR; |
451 | } |
452 | } |
452 | |
453 | |
453 | tcp_connection::tcp_connection (int fd_, const sockinfo &si_, vpn &v_) |
454 | tcp_connection::tcp_connection (int fd_, const sockinfo &si_, vpn &v_) |
454 | : v(v_), si(si_), ev::io(this, &tcp_connection::tcpv4_ev) |
455 | : v(v_), si(si_), ev::io(this, &tcp_connection::tcpv4_ev) |