connection_check, simplified

The protocol handler method `connection_check` allowed to variable
operations to trigger with variable result bits. Only the `CONNCHECK_ISDEAD`
and `CONNRESULT_DEAD` were in use. Transform the function into
`connection_is_dead` without extra parameter and a bool result.

- Remove defines for `CONNCHECK_*` and `CONNRESULT_*`
- Rename protocol function in handler comments
- Change RTSP implementation (only protocol that uses this)

Closes #20890
This commit is contained in:
Stefan Eissing 2026-03-11 15:25:45 +01:00 committed by Daniel Stenberg
parent 015f1c7de4
commit da7bfb89a1
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
21 changed files with 37 additions and 70 deletions

View file

@ -126,19 +126,13 @@ static CURLcode rtsp_setup_connection(struct Curl_easy *data,
/*
* Function to check on various aspects of a connection.
*/
static uint32_t rtsp_conncheck(struct Curl_easy *data,
struct connectdata *conn,
uint32_t checks_to_perform)
static bool rtsp_conn_is_dead(struct Curl_easy *data,
struct connectdata *conn)
{
unsigned int ret_val = CONNRESULT_NONE;
if(checks_to_perform & CONNCHECK_ISDEAD) {
bool input_pending;
if(!Curl_conn_is_alive(data, conn, &input_pending))
ret_val |= CONNRESULT_DEAD;
}
return ret_val;
bool input_pending;
/* Contrary to default handling, this protocol allows pending
* input on an unused connection. */
return !Curl_conn_is_alive(data, conn, &input_pending);
}
static CURLcode rtsp_connect(struct Curl_easy *data, bool *done)
@ -1072,7 +1066,7 @@ static const struct Curl_protocol Curl_protocol_rtsp = {
ZERO_NULL, /* disconnect */
rtsp_rtp_write_resp, /* write_resp */
rtsp_rtp_write_resp_hd, /* write_resp_hd */
rtsp_conncheck, /* connection_check */
rtsp_conn_is_dead, /* connection_is_dead */
ZERO_NULL, /* attach connection */
Curl_http_follow, /* follow */
};