mirror of
https://github.com/curl/curl.git
synced 2026-08-26 04:03:32 +03:00
lib: keepon improving
Improve the name, type and handling of `data->req.keepon`: - Rename `keepon` to `io_flags` - make `io_flags` and `uint8_t` and reposition in struct - Rename `KEEP_*` defines to `REQ_IO_*`, move to request.h - Replace all direct bit tests to `CURL_REQ_WANT_*` use - Replace all direct bit manipulations with new macros Closes #20905
This commit is contained in:
parent
9325eb5fc4
commit
f50446f6da
13 changed files with 78 additions and 79 deletions
|
|
@ -696,8 +696,8 @@ static void myssh_block2waitfor(struct connectdata *conn,
|
|||
int dir = ssh_get_poll_flags(sshc->ssh_session);
|
||||
/* translate the libssh define bits into our own bit defines */
|
||||
sshc->waitfor =
|
||||
((dir & SSH_READ_PENDING) ? KEEP_RECV : 0) |
|
||||
((dir & SSH_WRITE_PENDING) ? KEEP_SEND : 0);
|
||||
((dir & SSH_READ_PENDING) ? REQ_IO_RECV : 0) |
|
||||
((dir & SSH_WRITE_PENDING) ? REQ_IO_SEND : 0);
|
||||
}
|
||||
else
|
||||
sshc->waitfor = 0;
|
||||
|
|
@ -1084,7 +1084,7 @@ static int myssh_in_UPLOAD_INIT(struct Curl_easy *data,
|
|||
/* upload data */
|
||||
Curl_xfer_setup_send(data, FIRSTSOCKET);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
/* not set by Curl_xfer_setup to preserve io_flags */
|
||||
data->conn->recv_idx = FIRSTSOCKET;
|
||||
|
||||
/* since we do not really wait for anything at this point, we want the
|
||||
|
|
@ -1205,7 +1205,7 @@ static int myssh_in_SFTP_DOWNLOAD_STAT(struct Curl_easy *data,
|
|||
}
|
||||
Curl_xfer_setup_recv(data, FIRSTSOCKET, data->req.size);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
/* not set by Curl_xfer_setup to preserve io_flags */
|
||||
data->conn->send_idx = 0;
|
||||
|
||||
sshc->sftp_recv_state = 0;
|
||||
|
|
@ -1736,7 +1736,7 @@ static int myssh_SSH_SCP_DOWNLOAD(struct Curl_easy *data,
|
|||
data->req.maxdownload = bytecount;
|
||||
Curl_xfer_setup_recv(data, FIRSTSOCKET, bytecount);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
/* not set by Curl_xfer_setup to preserve io_flags */
|
||||
data->conn->send_idx = 0;
|
||||
|
||||
myssh_to(data, sshc, SSH_STOP);
|
||||
|
|
@ -2159,7 +2159,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data,
|
|||
/* upload data */
|
||||
Curl_xfer_setup_send(data, FIRSTSOCKET);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
/* not set by Curl_xfer_setup to preserve io_flags */
|
||||
data->conn->recv_idx = FIRSTSOCKET;
|
||||
|
||||
myssh_to(data, sshc, SSH_STOP);
|
||||
|
|
@ -2268,12 +2268,12 @@ static CURLcode myssh_pollset(struct Curl_easy *data,
|
|||
if(!sshc || (sock == CURL_SOCKET_BAD))
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
waitfor = sshc->waitfor ? sshc->waitfor : data->req.keepon;
|
||||
waitfor = sshc->waitfor ? sshc->waitfor : data->req.io_flags;
|
||||
if(waitfor) {
|
||||
int flags = 0;
|
||||
if(waitfor & KEEP_RECV)
|
||||
if(waitfor & REQ_IO_RECV)
|
||||
flags |= CURL_POLL_IN;
|
||||
if(waitfor & KEEP_SEND)
|
||||
if(waitfor & REQ_IO_SEND)
|
||||
flags |= CURL_POLL_OUT;
|
||||
DEBUGASSERT(flags);
|
||||
CURL_TRC_SSH(data, "pollset, flags=%x", flags);
|
||||
|
|
@ -2596,7 +2596,7 @@ static CURLcode myssh_done(struct Curl_easy *data,
|
|||
if(Curl_pgrsDone(data))
|
||||
return CURLE_ABORTED_BY_CALLBACK;
|
||||
|
||||
data->req.keepon = 0; /* clear all bits */
|
||||
CURL_REQ_CLEAR_IO(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue