mirror of
https://github.com/curl/curl.git
synced 2026-06-05 09:14:15 +03:00
multi: replace remaining EXPIRE_RUN_NOW
Remove EXPIRE_RUN_NOW completely. Replace the remaining use of EXPIRE_RUN_NOW with marking transfers as dirty.
This commit is contained in:
parent
7ed9dac2f9
commit
971d56cfa2
5 changed files with 23 additions and 28 deletions
12
lib/easy.c
12
lib/easy.c
|
|
@ -1154,13 +1154,15 @@ CURLcode curl_easy_pause(CURL *d, int action)
|
|||
|
||||
/* If not completely pausing both directions now, run again in any case. */
|
||||
if(!Curl_xfer_is_blocked(data)) {
|
||||
Curl_expire(data, 0, EXPIRE_RUN_NOW);
|
||||
/* reset the too-slow time keeper */
|
||||
data->state.keeps_speed.tv_sec = 0;
|
||||
/* On changes, tell application to update its timers. */
|
||||
if(changed && data->multi) {
|
||||
if(Curl_update_timer(data->multi) && !result)
|
||||
result = CURLE_ABORTED_BY_CALLBACK;
|
||||
if(data->multi) {
|
||||
Curl_multi_mark_dirty(data); /* make it run */
|
||||
/* On changes, tell application to update its timers. */
|
||||
if(changed) {
|
||||
if(Curl_update_timer(data->multi) && !result)
|
||||
result = CURLE_ABORTED_BY_CALLBACK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
32
lib/multi.c
32
lib/multi.c
|
|
@ -465,22 +465,6 @@ CURLMcode curl_multi_add_handle(CURLM *m, CURL *d)
|
|||
is called. */
|
||||
data->multi = multi;
|
||||
|
||||
/* Set the timeout for this handle to expire really soon so that it will
|
||||
be taken care of even when this handle is added in the midst of operation
|
||||
when only the curl_multi_socket() API is used. During that flow, only
|
||||
sockets that time-out or have actions will be dealt with. Since this
|
||||
handle has no action yet, we make sure it times out to get things to
|
||||
happen. */
|
||||
Curl_expire(data, 0, EXPIRE_RUN_NOW);
|
||||
|
||||
rc = Curl_update_timer(multi);
|
||||
if(rc) {
|
||||
data->multi = NULL; /* not anymore */
|
||||
Curl_uint_tbl_remove(&multi->xfers, data->mid);
|
||||
data->mid = UINT_MAX;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* set the easy handle */
|
||||
multistate(data, MSTATE_INIT);
|
||||
|
||||
|
|
@ -499,6 +483,18 @@ CURLMcode curl_multi_add_handle(CURLM *m, CURL *d)
|
|||
Curl_cpool_xfer_init(data);
|
||||
multi_warn_debug(multi, data);
|
||||
|
||||
/* Make sure the new handle will run */
|
||||
Curl_multi_mark_dirty(data);
|
||||
/* Necessary in event based processing, where dirty handles trigger
|
||||
* a timeout callback invocation. */
|
||||
rc = Curl_update_timer(multi);
|
||||
if(rc) {
|
||||
data->multi = NULL; /* not anymore */
|
||||
Curl_uint_tbl_remove(&multi->xfers, data->mid);
|
||||
data->mid = UINT_MAX;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* The admin handle only ever has default timeouts set. To improve the
|
||||
state somewhat we clone the timeouts from each added handle so that the
|
||||
admin handle always has the same timeouts as the most recently added
|
||||
|
|
@ -3631,9 +3627,7 @@ static void move_pending_to_connect(struct Curl_multi *multi,
|
|||
Curl_uint_bset_add(&multi->process, data->mid);
|
||||
|
||||
multistate(data, MSTATE_CONNECT);
|
||||
|
||||
/* Make sure that the handle will be processed soonish. */
|
||||
Curl_expire(data, 0, EXPIRE_RUN_NOW);
|
||||
Curl_multi_mark_dirty(data); /* make it run */
|
||||
}
|
||||
|
||||
/* process_pending_handles() moves a handle from PENDING back into the process
|
||||
|
|
|
|||
|
|
@ -963,7 +963,6 @@ typedef enum {
|
|||
EXPIRE_HAPPY_EYEBALLS_DNS, /* See asyn-ares.c */
|
||||
EXPIRE_HAPPY_EYEBALLS,
|
||||
EXPIRE_MULTI_PENDING,
|
||||
EXPIRE_RUN_NOW,
|
||||
EXPIRE_SPEEDCHECK,
|
||||
EXPIRE_TIMEOUT,
|
||||
EXPIRE_TOOFAST,
|
||||
|
|
|
|||
|
|
@ -742,7 +742,7 @@ static CURLcode h3_data_pause(struct Curl_cfilter *cf,
|
|||
{
|
||||
if(!pause) {
|
||||
h3_drain_stream(cf, data);
|
||||
Curl_expire(data, 0, EXPIRE_RUN_NOW);
|
||||
Curl_multi_mark_dirty(data);
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ static CURLcode cf_test_connect(struct Curl_cfilter *cf,
|
|||
infof(data, "%04dms: cf[%s] continuing", (int)duration_ms, ctx->id);
|
||||
curlx_wait_ms(10);
|
||||
}
|
||||
Curl_expire(data, ctx->fail_delay_ms - duration_ms, EXPIRE_RUN_NOW);
|
||||
Curl_expire(data, ctx->fail_delay_ms - duration_ms, EXPIRE_TIMEOUT);
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ static CURLcode cf_test_create(struct Curl_cfilter **pcf,
|
|||
if(result)
|
||||
goto out;
|
||||
|
||||
Curl_expire(data, ctx->fail_delay_ms, EXPIRE_RUN_NOW);
|
||||
Curl_expire(data, ctx->fail_delay_ms, EXPIRE_TIMEOUT);
|
||||
|
||||
out:
|
||||
*pcf = (!result) ? cf : NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue