mirror of
https://github.com/curl/curl.git
synced 2026-07-24 13:57:16 +03:00
multi: add dirty bitset
Add a bitset `dirty` to the multi handle. The presence of a transfer int he "dirty" set means: this transfer has something to do ASAP. "dirty" is set by multiplexing protocols like HTTP/2 and 3 when encountering response data for another transfer than the current one. "dirty" is set by protocols that want to be called. Implementation: * just an additional `uint_bset` in the multi handle * `Curl_multi_mark_dirty()` to add a transfer to the dirty set. * `multi_runsingle()` clears the dirty bit of the transfer at start. Without new dirty marks, this empties the set after al dirty transfers have been run. * `multi_timeout()` immediately gives the current time and timeout_ms == 0 when dirty transfers are present. * multi_event: marks all transfers tracked for a socket as dirty. Then marks all expired transfers as dirty. Then it runs all dirty transfers. With this mechanism: * Most uses of `EXPIRE_RUN_NOW` are replaced by `Curl_multi_mark_dirty()` * `Curl_multi_mark_dirty()` is cheaper than querying if a transfer is already dirty or set for timeout. There is no need to check, just do it. * `data->state.select_bits` is eliminated. We need no longer to simulate a poll event to make a transfer run. Closes #17662
This commit is contained in:
parent
7aa8d1eea1
commit
779937f840
20 changed files with 162 additions and 285 deletions
|
|
@ -732,15 +732,9 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data,
|
|||
figure out a "real" bitmask */
|
||||
sshc->orig_waitfor = data->req.keepon;
|
||||
|
||||
/* we want to use the _sending_ function even when the socket turns
|
||||
out readable as the underlying libssh2 sftp send function will deal
|
||||
with both accordingly */
|
||||
data->state.select_bits = CURL_CSELECT_OUT;
|
||||
|
||||
/* since we do not really wait for anything at this point, we want the
|
||||
state machine to move on as soon as possible so we set a very short
|
||||
timeout here */
|
||||
Curl_expire(data, 0, EXPIRE_RUN_NOW);
|
||||
state machine to move on as soon as possible */
|
||||
Curl_multi_mark_dirty(data);
|
||||
|
||||
wssh_state(data, sshc, SSH_STOP);
|
||||
}
|
||||
|
|
@ -828,11 +822,6 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data,
|
|||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
conn->writesockfd = conn->sockfd;
|
||||
|
||||
/* we want to use the _receiving_ function even when the socket turns
|
||||
out writableable as the underlying libssh2 recv function will deal
|
||||
with both accordingly */
|
||||
data->state.select_bits = CURL_CSELECT_IN;
|
||||
|
||||
if(result) {
|
||||
/* this should never occur; the close state should be entered
|
||||
at the time the error occurs */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue