Re: [PATCH v3 2/3] http.c: Use timeout suggested by curl instead of fixed 50ms timeout
Subsystems:
the rest
4 messages,
3 authors,
2016-06-15 · open the first message on its own page
Mika Fischer [off-list ref] writes:
Recent versions of curl can suggest a period of time the library user
should sleep and try again, when curl is blocked on reading or writing
(or connecting). Use this timeout instead of always sleeping for 50ms.
Signed-off-by: Mika Fischer <redacted>
Thanks.
I'm inclined to squash in the following to narrow the scope of
curl_timeout, though.
diff --git a/http.c b/http.c
index 5cb0fb6..924be52 100644
--- a/http.c
+++ b/http.c @@ -636,9 +636,6 @@ void run_active_slot(struct active_request_slot *slot)
fd_set excfds ;
int max_fd ;
struct timeval select_timeout ;
- #if LIBCURL_VERSION_NUM >= 0x070f04
- long curl_timeout ;
- #endif
int finished = 0 ;
slot -> finished = & finished ; @@ -655,6 +652,7 @@ void run_active_slot(struct active_request_slot *slot)
if ( slot -> in_use && ! data_received ) {
#if LIBCURL_VERSION_NUM >= 0x070f04
+ long curl_timeout ;
curl_multi_timeout ( curlm , & curl_timeout );
if ( curl_timeout == 0 ) {
continue ;
On Fri, Nov 4, 2011 at 18:13, Junio C Hamano [off-list ref] wrote: quoted hunk I'm inclined to squash in the following to narrow the scope of
curl_timeout, though.
diff --git a/http.c b/http.c
index 5cb0fb6..924be52 100644
--- a/http.c
+++ b/http.c @@ -636,9 +636,6 @@ void run_active_slot(struct active_request_slot *slot) fd_set excfds;
int max_fd;
struct timeval select_timeout;
-#if LIBCURL_VERSION_NUM >= 0x070f04
- long curl_timeout;
-#endif
int finished = 0;
slot->finished = &finished; @@ -655,6 +652,7 @@ void run_active_slot(struct active_request_slot *slot)
if (slot->in_use && !data_received) {
#if LIBCURL_VERSION_NUM >= 0x070f04
+ long curl_timeout;
curl_multi_timeout(curlm, &curl_timeout);
if (curl_timeout == 0) {
continue;
Ah yes, that's good. I would have done it this way in C++, but I
wasn't sure whether C99 is OK for git.
On Fri, Nov 04, 2011 at 06:47:44PM +0100, Mika Fischer wrote:
quoted if (slot->in_use && !data_received) {
#if LIBCURL_VERSION_NUM >= 0x070f04
+ long curl_timeout;
curl_multi_timeout(curlm, &curl_timeout);
if (curl_timeout == 0) {
continue;
Ah yes, that's good. I would have done it this way in C++, but I
wasn't sure whether C99 is OK for git.
C99 is not OK. But this is not C99, as the conditional opens a new
block.
-Peff
On Fri, Nov 4, 2011 at 18:51, Jeff King [off-list ref] wrote: quoted Ah yes, that's good. I would have done it this way in C++, but I
wasn't sure whether C99 is OK for git.
C99 is not OK. But this is not C99, as the conditional opens a new
block.
Oh I see, thanks for clarifying!