lib: replace conn [write]sockfd members by index

The `connectdata` members `sockfd` and `writesockfd` needed to by either
CURL_SOCKET_BAD or a copy of one of `conn->sock[2]`. When equal to one,
that index was used to send/recv/poll the proper socket or connection
filter chain.

Replace those with `send_idx` and `recv_idx` which are either -1, 0 or 1
to indicate which socket/filter to send/receive on.

Closes #18179
This commit is contained in:
Stefan Eissing 2025-08-05 13:11:53 +02:00 committed by Daniel Stenberg
parent aec28f3ad3
commit 6d5570c4dd
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
9 changed files with 120 additions and 92 deletions

View file

@ -720,7 +720,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data,
Curl_xfer_setup1(data, CURL_XFER_SEND, -1, FALSE);
/* not set by Curl_xfer_setup to preserve keepon bits */
conn->sockfd = conn->writesockfd;
data->conn->recv_idx = FIRSTSOCKET;
if(result) {
wssh_state(data, sshc, SSH_SFTP_CLOSE);
@ -819,7 +819,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data,
Curl_xfer_setup1(data, CURL_XFER_RECV, data->req.size, FALSE);
/* not set by Curl_xfer_setup to preserve keepon bits */
conn->writesockfd = conn->sockfd;
conn->send_idx = 0;
if(result) {
/* this should never occur; the close state should be entered