quic: add Curl_quic_idle

Add Curl_quic_idle which is called when no HTTP level read or write is
performed.  It is a good place to handle timer expiry for QUIC transport
(.e.g, retransmission).

Closes #8698
This commit is contained in:
Tatsuhiro Tsujikawa 2022-04-12 19:10:46 +09:00 committed by Daniel Stenberg
parent 53678992d5
commit 6fcd3e6f51
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
5 changed files with 54 additions and 0 deletions

View File

@ -54,6 +54,7 @@ void Curl_quic_done(struct Curl_easy *data, bool premature);
bool Curl_quic_data_pending(const struct Curl_easy *data);
void Curl_quic_disconnect(struct Curl_easy *data,
struct connectdata *conn, int tempindex);
CURLcode Curl_quic_idle(struct Curl_easy *data);
#else /* ENABLE_QUIC */
#define Curl_quic_done_sending(x)

View File

@ -1222,6 +1222,14 @@ CURLcode Curl_readwrite(struct connectdata *conn,
infof(data, "Done waiting for 100-continue");
}
}
#ifdef ENABLE_QUIC
if(conn->transport == TRNSPRT_QUIC) {
result = Curl_quic_idle(data);
if(result)
return result;
}
#endif
}
if(Curl_pgrsUpdate(data))

View File

@ -500,4 +500,16 @@ bool Curl_quic_data_pending(const struct Curl_easy *data)
return stream->recv_header_len || stream->recv_data_len;
}
/*
* Called from transfer.c:Curl_readwrite when neither HTTP level read
* nor write is performed. It is a good place to handle timer expiry
* for QUIC transport.
*/
CURLcode Curl_quic_idle(struct Curl_easy *data)
{
(void)data;
H3BUGF(infof(data, "Curl_quic_idle"));
return CURLE_OK;
}
#endif /* USE_MSH3 */

View File

@ -1894,4 +1894,26 @@ bool Curl_quic_data_pending(const struct Curl_easy *data)
return Curl_dyn_len(&stream->overflow) > 0;
}
/*
* Called from transfer.c:Curl_readwrite when neither HTTP level read
* nor write is performed. It is a good place to handle timer expiry
* for QUIC transport.
*/
CURLcode Curl_quic_idle(struct Curl_easy *data)
{
struct connectdata *conn = data->conn;
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
struct quicsocket *qs = conn->quic;
if(ngtcp2_conn_get_expiry(qs->qconn) > timestamp()) {
return CURLE_OK;
}
if(ng_flush_egress(data, sockfd, qs)) {
return CURLE_SEND_ERROR;
}
return CURLE_OK;
}
#endif

View File

@ -864,4 +864,15 @@ bool Curl_quic_data_pending(const struct Curl_easy *data)
return FALSE;
}
/*
* Called from transfer.c:Curl_readwrite when neither HTTP level read
* nor write is performed. It is a good place to handle timer expiry
* for QUIC transport.
*/
CURLcode Curl_quic_idle(struct Curl_easy *data)
{
(void)data;
return CURLE_OK;
}
#endif