From c75f63d7c432ab42614c05f8a8081edf4beb9ee9 Mon Sep 17 00:00:00 2001 From: Max Dymond Date: Wed, 31 May 2017 12:09:56 +0100 Subject: handler: refactor connection checking Add a new type of callback to Curl_handler which performs checks on the connection. Alter RTSP so that it uses this callback to do its own check on connection health. --- lib/urldata.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/urldata.h') diff --git a/lib/urldata.h b/lib/urldata.h index e89d1d706..41f9408ba 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -829,6 +829,12 @@ struct Curl_handler { CURLcode (*readwrite)(struct Curl_easy *data, struct connectdata *conn, ssize_t *nread, bool *readmore); + /* This function can perform various checks on the connection. See + CONNCHECK_* for more information about the checks that can be performed, + and CONNRESULT_* for the results that can be returned. */ + unsigned int (*connection_check)(struct connectdata *conn, + unsigned int checks_to_perform); + long defport; /* Default port. */ unsigned int protocol; /* See CURLPROTO_* - this needs to be the single specific protocol bit */ @@ -859,6 +865,12 @@ struct Curl_handler { HTTP proxy as HTTP proxies may know this protocol and act as a gateway */ +#define CONNCHECK_NONE 0 /* No checks */ +#define CONNCHECK_ISDEAD (1<<0) /* Check if the connection is dead. */ + +#define CONNRESULT_NONE 0 /* No extra information. */ +#define CONNRESULT_DEAD (1<<0) /* The connection is dead. */ + /* return the count of bytes sent, or -1 on error */ typedef ssize_t (Curl_send)(struct connectdata *conn, /* connection data */ int sockindex, /* socketindex */ -- cgit v1.2.3