The following commit has been merged in the master branch: commit 93e39ae07edba8f582ca34aa2dc8a597d9532819 Author: Marek Lindner lindner_marek@yahoo.de Date: Fri Oct 6 00:36:15 2006 +0200
keep alive timeout fix
diff --git a/posix.c b/posix.c index a267162..b2b11d9 100644 --- a/posix.c +++ b/posix.c @@ -117,7 +117,7 @@ void *client_to_gw_tun( void *arg ) {
/* connect to server (ask permission) */ if ( ( curr_gateway_tcp_sock = socket(PF_INET, SOCK_STREAM, 0) ) < 0 ) { - + perror("socket"); curr_gateway = NULL; return NULL; @@ -134,8 +134,8 @@ void *client_to_gw_tun( void *arg ) { }
server_keep_alive_timeout = get_time(); - - + + /* connect to server (establish udp tunnel) */ if ( ( curr_gateway_tun_sock = socket(PF_INET, SOCK_DGRAM, 0) ) < 0 ) {
@@ -184,8 +184,8 @@ void *client_to_gw_tun( void *arg ) { while ( ( !is_aborted() ) && ( curr_gateway != NULL ) ) {
- if (server_keep_alive_timeout + 30 >= get_time()) { - + if (server_keep_alive_timeout + 30 < get_time()) { + server_keep_alive_timeout = get_time(); strcpy (buff, "ping\0"); if (write (curr_gateway_tcp_sock, buff,5) < 0) { @@ -194,15 +194,15 @@ void *client_to_gw_tun( void *arg ) { }
} - - + + tv.tv_sec = 0; tv.tv_usec = 250;
tmp_wait_sockets = wait_sockets;
res = select(max_sock + 1, &tmp_wait_sockets, NULL, NULL, &tv); - + if ( res > 0 ) {
/* tcp message from server */