diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2011-05-26 01:29:34 +0200 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2011-05-26 02:00:30 +0200 |
commit | cc9397414a655cab4c47de6559e69ecda06530cc (patch) | |
tree | a3487afc29da036c58b9d321804571fbfae2f72a /socket.c | |
parent | ce36699e50f90ae17577dfd81be78f6c1b883aec (diff) | |
download | fetchmail-cc9397414a655cab4c47de6559e69ecda06530cc.tar.gz fetchmail-cc9397414a655cab4c47de6559e69ecda06530cc.tar.bz2 fetchmail-cc9397414a655cab4c47de6559e69ecda06530cc.zip |
Revert SO_???TIMEO-based STARTTLS timeout handling.
This reverts commits 47c05b10018f5ec7493e4bd9f521aaa18d96f1e2
and 72ce8bce8dd655b6aefa33d0a74e883dad5202b5, the code isn't portable,
for instance, Solaris does not support SO_RCVTIMEO/SO_SNDTIMEO.
These socket-level options are known, but Solaris returns EAFNOSUPPORT.
Reported by Jonathan Buschmann.
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 29 |
1 files changed, 1 insertions, 28 deletions
@@ -200,31 +200,6 @@ static int handle_plugin(const char *host, } #endif /* HAVE_SOCKETPAIR */ -static int setsocktimeout(int sock, int which, int timeout) { - struct timeval tv; - int rc; - - tv.tv_sec = timeout; - tv.tv_usec = 0; - rc = setsockopt(sock, SOL_SOCKET, which, &tv, sizeof(tv)); - if (rc) { - report(stderr, GT_("setsockopt(%d, SOL_SOCKET) failed: %s\n"), sock, strerror(errno)); - } - return rc; -} - -/** Configure socket options such as send/receive timeout at the socket - * level, to avoid network-induced stalls. - */ -int SockTimeout(int sock, int timeout) -{ - int err = 0; - - if (setsocktimeout(sock, SO_RCVTIMEO, timeout)) err = 1; - if (setsocktimeout(sock, SO_SNDTIMEO, timeout)) err = 1; - return err; -} - /** Set socket to SO_KEEPALIVE. \return 0 for success. */ int SockKeepalive(int sock) { int keepalive = 1; @@ -251,7 +226,6 @@ int UnixOpen(const char *path) */ mailserver_socket_temp = sock; - SockTimeout(sock, mytimeout); if (connect(sock, (struct sockaddr *) &ad, sizeof(ad)) < 0) { int olderr = errno; @@ -326,7 +300,6 @@ int SockOpen(const char *host, const char *service, continue; } - SockTimeout(i, mytimeout); SockKeepalive(i); /* Save socket descriptor. @@ -391,8 +364,8 @@ va_dcl { #endif vsnprintf(buf, sizeof(buf), format, ap); va_end(ap); - SockTimeout(sock, mytimeout); return SockWrite(sock, buf, strlen(buf)); + } #ifdef SSL_ENABLE |