--- parser3/src/main/pa_common.C 2004/12/10 07:55:22 1.199 +++ parser3/src/main/pa_common.C 2004/12/10 08:37:53 1.201 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_COMMON_C="$Date: 2004/12/10 07:55:22 $"; +static const char * const IDENT_COMMON_C="$Date: 2004/12/10 08:37:53 $"; #include "pa_common.h" #include "pa_exception.h" @@ -222,7 +222,8 @@ static int http_request(char*& response, 0, "zero hostname"); //never - volatile int sock=-1; + volatile // to prevent makeing it register variable, because it will be clobbered by longjmp [thanks gcc warning] + int sock=-1; #ifdef PA_USE_ALARM signal(SIGALRM, timeout_handler); #endif @@ -256,23 +257,17 @@ static int http_request(char*& response, "can not make socket: %s (%d)", pa_socks_strerr(no), no); } -#ifdef SO_DONTLINGER - int dont_linger = 0; - setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, (const char *)&dont_linger, sizeof(dont_linger)); -#else // To enable SO_DONTLINGER (that is, disable SO_LINGER) // l_onoff should be set to zero and setsockopt should be called linger dont_linger={0,0}; setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *)&dont_linger, sizeof(dont_linger)); -#endif -#if defined(SO_SNDTIMEO) || defined(SO_RCVTIMEO) +#ifdef WIN32 +// SO_*TIMEO can be defined in .h but not implemlemented in protocol, +// failing subsequently with Option not supported by protocol (99) message +// could not suppress that, so leaving this only for win32 int timeout_ms=timeout_secs*1000; -#endif -#ifdef SO_SNDTIMEO setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const char*)&timeout_ms, sizeof(timeout_ms)); -#endif -#ifdef SO_RCVTIMEO setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout_ms, sizeof(timeout_ms)); #endif