Index: htnet/SSLConnection.cc =================================================================== --- htnet/SSLConnection.cc.orig +++ htnet/SSLConnection.cc @@ -131,18 +131,21 @@ { errno = 0; - if (timeout_value > 0) { - FD_SET_T fds; - FD_ZERO(&fds); - FD_SET(sock, &fds); - - timeval tv; - tv.tv_sec = timeout_value; - tv.tv_usec = 0; - - int selected = select(sock+1, &fds, 0, 0, &tv); - if (selected <= 0) - need_io_stop++; + if (!SSL_pending(ssl)) { + if (timeout_value > 0) { + FD_SET_T fds; + FD_ZERO(&fds); + FD_SET(sock, &fds); + + timeval tv; + tv.tv_sec = timeout_value; + tv.tv_usec = 0; + + int selected = select(sock+1, &fds, 0, 0, &tv); + if (selected <= 0) + need_io_stop++; + } + } if (!need_io_stop)