]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: pollset adjust, init with FIRSTSOCKET during connect
authorStefan Eissing <stefan@eissing.org>
Tue, 9 Jan 2024 08:29:34 +0000 (09:29 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 9 Jan 2024 16:41:13 +0000 (17:41 +0100)
- `conn->sockfd` is set by `Curl_setup_transfer()`, but that
  is called *after* the connection has been established
- use `conn->sock[FIRSTSOCKET]` instead

Follow-up to a0f94800d507de
Closes #12664

lib/multi.c

index e4491d912c980cfe423214f6922d9e2707344932..63ab67691ed7559d05eb14ed6a6a0d71d6815956 100644 (file)
@@ -998,9 +998,11 @@ static int connecting_getsock(struct Curl_easy *data, curl_socket_t *socks)
 {
   struct connectdata *conn = data->conn;
   (void)socks;
-  if(conn && conn->sockfd != CURL_SOCKET_BAD) {
+  /* Not using `conn->sockfd` as `Curl_setup_transfer()` initializes
+   * that *after* the connect. */
+  if(conn && conn->sock[FIRSTSOCKET] != CURL_SOCKET_BAD) {
     /* Default is to wait to something from the server */
-    socks[0] = conn->sockfd;
+    socks[0] = conn->sock[FIRSTSOCKET];
     return GETSOCK_READSOCK(0);
   }
   return GETSOCK_BLANK;