git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] http.c: Use curl_multi_fdset to select on curl fds instead of just sleeping

From
Mika Fischer <mika.fischer@zoopnet.de>
Date
Nov 2, 2011, 22:22 UTC
Message-ID
<CAOs=hR+QqUpYuth8Uvi2o7pm1LO8ogO2pN7nrMchYj96Cutmww@mail.gmail.com>
In-Reply-To
<20111102203221.GB5628@sigill.intra.peff.net>
On Wed, Nov 2, 2011 at 21:32, Jeff King <peff@peff.net> wrote:
Show 9 quoted lines
> Do we still need to care about data_received?
>
> My understanding was that the code was originally trying to do:
>
>  1. Call curl, maybe get some data.
>
>  2. If we got data, then ask curl against immediately for some data.
>
>  3. Otherwise, sleep 50ms and then ask curl again.
Yes, that's exactly what it did.
Show 7 quoted lines
> But now that we are actually selecting on the proper descriptors, it
> should now be safe to just do:
>
>  1. Call curl, maybe get some data.
>
>  2. Call select, which will wake immediately if curl is going to get
>     data.

The only problem I can see is that curl_multi_fdset is not guaranteed to return any fds. So in theory it could be possible that we don't get fds, but we're actually reading stuff. In this case things would get slow, because we would sleep for 50ms after every read...

However, I don't know if this is a case that actually comes up in the real world. Maybe Daniel has some advice on this.

Best,
 Mika
Previous: Junio C HamanoNext: Daniel Stenberg
Message 6 of 19 in “[PATCHv2] Improve use of select in http backend”
  1. Mika FischerNov 2, 2011
  2. 1/2 http.c: Use curl_multi_fdset to select on curl fds instead of just sleepingMika Fischer, Nov 2, 2011
  3. Jeff KingNov 2, 2011
  4. Jeff KingNov 2, 2011
  5. Junio C HamanoNov 2, 2011
  6. Mika FischerNov 2, 2011
  7. Daniel StenbergNov 2, 2011
  8. 2/2 http.c: Use timeout suggested by curl instead of fixed 50ms timeoutMika Fischer, Nov 2, 2011
  9. Junio C HamanoNov 3, 2011
  10. 0/3 Improve use of select in http backendMika Fischer, Nov 4, 2011
  11. 1/3 http.c: Use curl_multi_fdset to select on curl fds instead of just sleepingMika Fischer, Nov 4, 2011
  12. 2/3 http.c: Use timeout suggested by curl instead of fixed 50ms timeoutMika Fischer, Nov 4, 2011
  13. Junio C HamanoNov 4, 2011
  14. Mika FischerNov 4, 2011
  15. Jeff KingNov 4, 2011
  16. Mika FischerNov 4, 2011
  17. Junio C HamanoNov 4, 2011
  18. 3/3 http.c: Rely on select instead of tracking whether data was receivedMika Fischer, Nov 4, 2011
  19. Jeff KingNov 4, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.