From: Dr. Stephen Henson Date: Fri, 24 Jul 2009 13:07:08 +0000 (+0000) Subject: PR: 1990 X-Git-Tag: OpenSSL_1_0_0-beta4~129 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d069a4d15d51d9c0c8706951885843b2cdf2bcef;p=oweals%2Fopenssl.git PR: 1990 Update from 0.9.8-stable. --- diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index 027cdf943b..cd9f497a25 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c @@ -250,17 +250,22 @@ static void dgram_reset_rcv_timeout(BIO *b) { #if defined(SO_RCVTIMEO) bio_dgram_data *data = (bio_dgram_data *)b->ptr; + + /* Is a timer active? */ + if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0) + { #ifdef OPENSSL_SYS_WINDOWS - int timeout = data->socket_timeout.tv_sec * 1000 + - data->socket_timeout.tv_usec / 1000; - if (setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, - (void*)&timeout, sizeof(timeout)) < 0) - { perror("setsockopt"); } + int timeout = data->socket_timeout.tv_sec * 1000 + + data->socket_timeout.tv_usec / 1000; + if (setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, + (void*)&timeout, sizeof(timeout)) < 0) + { perror("setsockopt"); } #else - if ( setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, &(data->socket_timeout), - sizeof(struct timeval)) < 0) - { perror("setsockopt"); } + if ( setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, &(data->socket_timeout), + sizeof(struct timeval)) < 0) + { perror("setsockopt"); } #endif + } #endif }