Going strong after 12 years in the making.Â For the 27th time weâ€™re gathering friends in the Stockholm Sweden area who are interested in technology, open source, beers, slightly inaccurate Monty Python quotes, reverse engineering electronics and similar very important topics. We might also have a beer or two and talk rubbish.
On October 31st 2012 we invite all and every of our tech oriented friends to visit
We figured the 27th time would be the perfect time to do something new, so we now host the information on the fine snaxx.se domain.
Daniel Bogan of usesthis.com contacted me, and the result is now visible over at http://daniel.stenberg.usesthis.com:
Facebook contributes fix to libcurl’s multi interface to overcome problem with more than 1024 file descriptors.
When we introduced the multi interface to libcurl about (what feels like) one hundred years ago, we went with simple in some ways. One way it shows: an application that wants to do many transfers in parallel asks libcurl to do it, and then it extracts the set of file descriptors (sockets!) from libcurl (using curl_multi_fdset) to wait for as plain fd_sets. fd_set is the variable type made for select().Â This API choice made applications pretty much forced to use select. select() has Â its fair share of problems, where possibly the biggest one is that it has problems with file descriptors > 1024.
Later on we introduced an enhanced version of the multi interface for libcurl that allows an application to use whatever method it pleases. I tend to refer to that variation as the multi_socket API after its main function curl_multi_socket_action. That’s the high performance, event-driven API.
As you may be aware, event-driven code make things a bit more complicated at times so many people still prefer to use the older and simpler multi interface and thus they were forced to remain using select(). But now that era has ended. Now…
curl_multi_wait() is introduced!
This poll(3)-like function basically works as a replacement for curl_multi_fdset() + select(). Starting in libcurl 7.28.0 (strictly speaking in commitÂ de24d7bd4c03ea3), this is a function that any application can use for this purpose, and thus avoid the problem with many file descriptors.
This new function doesn’t use any struct from the “real” poll() or associated headers to make sure that it works even for systems without a real poll() implementation. It instead uses private curl versions of both the struct and the defines used. An application can of course also tell curl_multi_wait to wait for a set of private file descriptors, just like poll() or select().
The patch set that brought this function was provided by Sara Golemon, a friend from from a related project…