mirror of
https://github.com/curl/curl.git
synced 2026-06-11 23:04:17 +03:00
1 less goto
unify error handeling do less when retrying reorgenizing works? less agressive merging of retry and fail formating Co-authored-by: Viktor Szakats <vszakats@users.noreply.github.com> removed comment Co-authored-by: Viktor Szakats <vszakats@users.noreply.github.com>
This commit is contained in:
parent
471fd5d8e0
commit
16bb5d7f5d
1 changed files with 33 additions and 33 deletions
66
lib/multi.c
66
lib/multi.c
|
|
@ -54,10 +54,10 @@
|
|||
#include "socketpair.h"
|
||||
#include "socks.h"
|
||||
#include "urlapi-int.h"
|
||||
#include "altsvc.h"
|
||||
|
||||
/* The last 3 #include files should be in this order */
|
||||
#include "curl_printf.h"
|
||||
#include "altsvc.h" /* seems this is needed in this order */
|
||||
#include "curl_memory.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
|
|
@ -2433,10 +2433,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||
FALLTHROUGH();
|
||||
|
||||
case MSTATE_CONNECT:
|
||||
|
||||
#ifndef CURL_DISABLE_ALTSVC
|
||||
do_connect:
|
||||
#endif
|
||||
rc = state_connect(multi, data, nowp, &result);
|
||||
break;
|
||||
|
||||
|
|
@ -2667,34 +2663,6 @@ do_connect:
|
|||
}
|
||||
|
||||
statemachine_end:
|
||||
/* maybe retry if altsvc is breaking */
|
||||
#ifndef CURL_DISABLE_ALTSVC
|
||||
if(result &&
|
||||
data->asi && data->asi->used && !data->asi->errored) {
|
||||
data->asi->errored = is_altsvc_error(result);
|
||||
|
||||
if(data->asi->errored &&
|
||||
!(data->asi->flags & CURLALTSVC_NO_RETRY) &&
|
||||
data->mstate <= MSTATE_PROTOCONNECTING &&
|
||||
data->mstate >= MSTATE_CONNECT) {
|
||||
infof(data, "Alt-Svc connection failed(%d). "
|
||||
"Retrying with original target", result);
|
||||
|
||||
if(data->conn && stream_error) {
|
||||
bool dead_connection = result == CURLE_OPERATION_TIMEDOUT;
|
||||
struct connectdata *conn = data->conn;
|
||||
|
||||
Curl_detach_connection(data);
|
||||
Curl_conn_terminate(data, conn, dead_connection);
|
||||
}
|
||||
|
||||
stream_error = FALSE;
|
||||
multistate(data, MSTATE_CONNECT);
|
||||
goto do_connect;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(data->mstate < MSTATE_COMPLETED) {
|
||||
if(result) {
|
||||
/*
|
||||
|
|
@ -2708,6 +2676,38 @@ statemachine_end:
|
|||
/* Check if we can move pending requests to send pipe */
|
||||
process_pending_handles(multi); /* connection */
|
||||
|
||||
/* maybe retry if altsvc is breaking */
|
||||
#ifndef CURL_DISABLE_ALTSVC
|
||||
if(data->asi && data->asi->used && !data->asi->errored) {
|
||||
data->asi->errored = is_altsvc_error(result);
|
||||
|
||||
if(data->asi->errored &&
|
||||
!(data->asi->flags & CURLALTSVC_NO_RETRY) &&
|
||||
data->mstate <= MSTATE_PROTOCONNECTING &&
|
||||
data->mstate >= MSTATE_CONNECT) {
|
||||
|
||||
infof(data, "Alt-Svc connection failed(%d). "
|
||||
"Retrying with original target", result);
|
||||
if(data->conn) {
|
||||
/* Do not attempt to send data over a connection that timed out */
|
||||
bool dead_connection = result == CURLE_OPERATION_TIMEDOUT;
|
||||
struct connectdata *conn = data->conn;
|
||||
|
||||
/* This is where we make sure that the conn pointer is reset.
|
||||
We do not have to do this in every case block above where a
|
||||
failure is detected */
|
||||
Curl_detach_connection(data);
|
||||
Curl_conn_terminate(data, conn, dead_connection);
|
||||
}
|
||||
|
||||
stream_error = FALSE;
|
||||
multistate(data, MSTATE_CONNECT);
|
||||
result = CURLE_OK;
|
||||
rc = CURLM_CALL_MULTI_PERFORM;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(data->conn) {
|
||||
if(stream_error) {
|
||||
/* Do not attempt to send data over a connection that timed out */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue