pytest_05_09: increase reliability

Test has been flaky due to not waiting for the test server to be
listening. On slow CI systems, the started thread is late and the curl
command gets a refused connection.

Closes #21337
This commit is contained in:
Stefan Eissing 2026-04-16 09:14:58 +02:00 committed by Daniel Stenberg
parent 885b553545
commit 1bf1f8ed6a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 24 additions and 13 deletions

View file

@ -71,6 +71,7 @@
#include "curlx/strdup.h"
#include "system_win32.h"
#include "curlx/nonblock.h"
#include "curlx/strcopy.h"
#include "curlx/version_win32.h"
#include "curlx/strerr.h"
#include "curlx/strparse.h"
@ -1305,26 +1306,31 @@ static CURLcode cf_tcp_connect(struct Curl_cfilter *cf,
}
}
else if(rc & CURL_CSELECT_ERR) {
CURL_TRC_CF(data, cf, "poll/select error on fd=%" FMT_SOCKET_T, ctx->sock);
(void)verifyconnect(ctx->sock, &ctx->error);
result = CURLE_COULDNT_CONNECT;
}
out:
if(result) {
VERBOSE(char buffer[STRERROR_LEN]);
set_local_ip(cf, data);
if(ctx->error) {
VERBOSE(char buffer[STRERROR_LEN]);
set_local_ip(cf, data);
data->state.os_errno = ctx->error;
SET_SOCKERRNO(ctx->error);
infof(data, "connect to %s port %u from %s port %d failed: %s",
ctx->ip.remote_ip, ctx->ip.remote_port,
ctx->ip.local_ip, ctx->ip.local_port,
curlx_strerror(ctx->error, buffer, sizeof(buffer)));
VERBOSE(curlx_strerror(ctx->error, buffer, sizeof(buffer)));
}
else {
VERBOSE(curlx_strcopy(buffer, sizeof(buffer), STRCONST("peer closed")));
}
if(ctx->sock != CURL_SOCKET_BAD) {
socket_close(data, cf->conn, TRUE, ctx->sock);
ctx->sock = CURL_SOCKET_BAD;
}
infof(data, "connect to %s port %u from %s port %d failed: %s",
ctx->ip.remote_ip, ctx->ip.remote_port,
ctx->ip.local_ip, ctx->ip.local_port,
curlx_strerror(ctx->error, buffer, sizeof(buffer)));
*done = FALSE;
}
return result;