cfilter: provide call to tell connection to forget a socket

- fixed libssh.c workaround for a socket being closed by
  the library
- eliminate the terrible hack in cf-socket.c to guess when
  this happened and try not closing the socket again.
- fixes race in eyeballing when socket could have failed to
  be closed for a discarded connect attempt

Closes #12207
This commit is contained in:
Stefan Eissing 2023-10-26 17:02:45 +02:00 committed by Daniel Stenberg
parent 39547ae64d
commit 37b5cf4fa0
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 31 additions and 31 deletions

View file

@ -1963,10 +1963,9 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
ssh_disconnect(sshc->ssh_session);
if(!ssh_version(SSH_VERSION_INT(0, 10, 0))) {
/* conn->sock[FIRSTSOCKET] is closed by ssh_disconnect behind our back,
explicitly mark it as closed with the memdebug macro. This libssh
tell the connection to forget about it. This libssh
bug is fixed in 0.10.0. */
fake_sclose(conn->sock[FIRSTSOCKET]);
conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD;
Curl_conn_forget_socket(data, FIRSTSOCKET);
}
SSH_STRING_FREE_CHAR(sshc->homedir);