summaryrefslogtreecommitdiff
path: root/lib/cf-socket.c
diff options
context:
space:
mode:
authorStefan Eissing <stefan@eissing.org>2023-03-03 17:54:44 +0100
committerDaniel Stenberg <daniel@haxx.se>2023-03-06 20:16:43 +0100
commit257416023d179f84ab77a53406156871453e280f (patch)
treec1b6d86917538d3e45d7f689aa7e2bfa06456940 /lib/cf-socket.c
parent93eefa6ba134aceef4f6cd51fc602319b382e629 (diff)
downloadcurl-257416023d179f84ab77a53406156871453e280f.tar.gz
connect: fix time_connect and time_appconnect timer statistics
- time_connect was not updated when the overall connection failed, e.g. when SSL verification was unsuccessful, refs #10670 - rework gather those values to interrogate involved filters, also from all eyeballing attempts, to report the maximum of those values. - added 3 test cases in test_06 to check reported values on successful, partially failed and totally failed connections. Reported-by: Master Inspire Fixes #10670 Closes #10671
Diffstat (limited to 'lib/cf-socket.c')
-rw-r--r--lib/cf-socket.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/cf-socket.c b/lib/cf-socket.c
index f523b1332..006c22d2c 100644
--- a/lib/cf-socket.c
+++ b/lib/cf-socket.c
@@ -1441,22 +1441,6 @@ static CURLcode cf_socket_cntrl(struct Curl_cfilter *cf,
case CF_CTRL_CONN_INFO_UPDATE:
cf_socket_active(cf, data);
break;
- case CF_CTRL_CONN_REPORT_STATS:
- switch(ctx->transport) {
- case TRNSPRT_UDP:
- case TRNSPRT_QUIC:
- /* Since UDP connected sockets work different from TCP, we use the
- * time of the first byte from the peer as the "connect" time. */
- if(ctx->got_first_byte) {
- Curl_pgrsTimeWas(data, TIMER_CONNECT, ctx->first_byte_at);
- break;
- }
- /* FALLTHROUGH */
- default:
- Curl_pgrsTimeWas(data, TIMER_CONNECT, ctx->connected_at);
- break;
- }
- break;
case CF_CTRL_DATA_SETUP:
Curl_persistconninfo(data, cf->conn, ctx->l_ip, ctx->l_port);
break;
@@ -1517,6 +1501,24 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
else
*pres1 = -1;
return CURLE_OK;
+ case CF_QUERY_TIMER_CONNECT: {
+ struct curltime *when = pres2;
+ switch(ctx->transport) {
+ case TRNSPRT_UDP:
+ case TRNSPRT_QUIC:
+ /* Since UDP connected sockets work different from TCP, we use the
+ * time of the first byte from the peer as the "connect" time. */
+ if(ctx->got_first_byte) {
+ *when = ctx->first_byte_at;
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ *when = ctx->connected_at;
+ break;
+ }
+ return CURLE_OK;
+ }
default:
break;
}