Bug 17178

Summary: [curl] when using winsock, downloadTimerCallback bails
Product: WebKit Reporter: Kevin Ollivier <kevino>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal Keywords: Curl, Wx
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
On Win, don't call select unless we have a valid file descriptor
mrowe: review-
Don't call select when there are no valid file descriptors on any platform eric: review+

Description Kevin Ollivier 2008-02-04 14:44:29 PST
When building/running CURL with MSVC/winsock, we're seeing curl_multi_fdset return -1 for maxfd (which means there are no valid file descriptors), and this leads to an error when select() is called. That causes the download to bail out, meaning we can't even load pages. If we do not call select() in this case, all downloads start and complete successfully. 

Having this fixed is pretty critical for the wx port on Windows. Attached is a fix for the problem.
Comment 1 Kevin Ollivier 2008-02-04 14:45:12 PST
Created attachment 18919 [details]
On Win, don't call select unless we have a valid file descriptor
Comment 2 Mark Rowe (bdash) 2008-02-04 20:09:09 PST
Comment on attachment 18919 [details]
On Win, don't call select unless we have a valid file descriptor

That doesn't look right as it makes it possible for rc to be tested before being initialized.  Why does it make sense to call select on non-Windows platforms when there are no file descriptors?
Comment 3 Kevin Ollivier 2008-02-06 21:24:13 PST
Created attachment 18978 [details]
Don't call select when there are no valid file descriptors on any platform

Good point, I did some more testing and not calling select() seems to work fine on Unix platforms too, so I've taken out the #if PLATFORM(WIN_OS) and I've also initialized rc to 0 so that it won't be used uninitialized.
Comment 4 Eric Seidel (no email) 2008-02-10 10:44:48 PST
Comment on attachment 18978 [details]
Don't call select when there are no valid file descriptors on any platform

Looks fine to me.
Comment 5 Kevin Ollivier 2008-02-10 11:03:24 PST
Landed in r30121. Thanks!