--- gnash-0.8.8/libbase/curl_adapter.cpp 2010-08-27 10:44:37.665493001 +0200 +++ gnash-0.8.8.new/libbase/curl_adapter.cpp 2010-08-27 10:44:48.962493001 +0200 @@ -607,11 +607,7 @@ int maxfd; CURLMcode mcode; timeval tv; - - // Hard-coded slect timeout. - // This number is kept low to give more thread switch - // opportunities while waiting for a load. - const long maxSleepUsec = 10000; // 1/100 of a second + long multi_timeout_ms; const unsigned int userTimeout = static_cast( RcInitFile::getDefaultInstance().getStreamsTimeout()*1000); @@ -666,11 +662,16 @@ FD_ZERO(&writefd); FD_ZERO(&exceptfd); - tv.tv_sec = 0; - tv.tv_usec = maxSleepUsec; + mcode = curl_multi_timeout(_mhandle, &multi_timeout_ms); + if (mcode != CURLM_OK) { + throw GnashException(curl_multi_strerror(mcode)); + } + + tv.tv_sec = multi_timeout_ms / 1000; + tv.tv_usec = (multi_timeout_ms % 1000) * 1000; #ifdef GNASH_CURL_VERBOSE - log_debug("select() with %d milliseconds timeout", maxSleepUsec*1000); + log_debug("select() with %ld milliseconds timeout", multi_timeout_ms); #endif // Wait for data on the filedescriptors until a timeout set