On 08/27/2010 02:56 AM, Hans de Goede wrote:
> So I did some debugging and found at that there is a bad interaction
> between gnash and the latest libcurl, the attached
> gnash-0.8.8-new-libcurl.patch fixes this.
>
> The problem is that newer libcurl versions (atleast 7.21.x) return -1
> for maxfd from curl_multi_fdset while they are doing dns resolving. This
> gets combined with a short (7ms) return value from curl_multi_timeout
> indicating that the thread / caller should just sleep a bit and then retry.
I fixed this a better way, as we do want to check the value of max_fd
for problems. I filed an official bug report on this for Gnash, which
contains my latest patch: https://savannah.gnu.org/bugs/?31235. With
this patch, Gnash works with the very latest libcurl as well as the
older one. Please test attached the patch, if it's good for you, I'll
check it in.
- rob -
diff --git a/libbase/curl_adapter.cpp b/libbase/curl_adapter.cpp
index 4604bee..49aa261 100644
--- a/libbase/curl_adapter.cpp
+++ b/libbase/curl_adapter.cpp
@@ -591,7 +591,6 @@ CurlStreamFile::fillCacheNonBlocking()
void
CurlStreamFile::fillCache(std::streamsize size)
{
-
#if GNASH_CURL_VERBOSE
log_debug("fillCache(%d), called, currently cached: %d", size, _cached);
#endif
@@ -641,27 +640,36 @@ CurlStreamFile::fillCache(std::streamsize size)
#if GNASH_CURL_VERBOSE
//log_debug("cached: %d, size: %d", _cached, size);
#endif
-
- mcode = curl_multi_fdset(_mhandle, &readfd, &writefd,
- &exceptfd, &maxfd);
-
- if (mcode != CURLM_OK) {
- // This is a serious error, not just a failure to add any
- // fds.
- throw GnashException(curl_multi_strerror(mcode));
- }
-
+ mcode = curl_multi_fdset(_mhandle, &readfd, &writefd,
+ &exceptfd, &maxfd);
+
+ if (mcode != CURLM_OK) {
+ // This is a serious error, not just a failure to add any
+ // fds.
+ throw GnashException(curl_multi_strerror(mcode));
+ }
+
#ifdef GNASH_CURL_VERBOSE
- log_debug("Max fd: %d", maxfd);
+ log_debug("Max fd: %d", maxfd);
#endif
-
- // A value of -1 means no file descriptors were added.
- if (maxfd < 0) {
+
+ // A value of -1 means no file descriptors were added.
+ if (maxfd < 0) {
+ // As of libcurl 7.21.x, the DNS resolving appears to be going
+ // on in the background, so curl_multi_fdset fails to return
+ // anything useful. So we use the user timeout value to
+ // give DNS enough time to resolve the lookup.
+ if (userTimeout && lastProgress.elapsed() > userTimeout) {
+ log_error(_("Timeout (%u milliseconds) while waiting for "
+ "the socket to become ready."), userTimeout);
#if GNASH_CURL_VERBOSE
- log_debug("No filedescriptors; breaking");
+ log_debug("No filedescriptors; breaking");
#endif
- break;
- }
+ break;
+ } else {
+ continue;
+ }
+ }
FD_ZERO(&readfd);
FD_ZERO(&writefd);
@@ -1146,7 +1154,6 @@ CurlStreamFile::tell() const
bool
CurlStreamFile::seek(std::streampos pos)
{
-
assert(pos >= 0);
#ifdef GNASH_CURL_WARN_SEEKSBACK
@@ -1380,7 +1387,6 @@ std::auto_ptr<IOChannel>
NetworkAdapter::makeStream(const std::string& url, const std::string& postdata,
const RequestHeaders& headers, const std::string& cachefile)
{
-
std::auto_ptr<IOChannel> stream;
try {
@@ -1440,5 +1446,5 @@ NetworkAdapter::reservedNames()
// Local Variables:
// mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: null
// End:
_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev