mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 16:48:49 -05:00
ngtcp2: remove fprintf() calls
- convert some of them to H3BUF() calls to infof() - remove some of them completely - made DEBUG_HTTP3 defined only if CURLDEBUG is set for now Closes #4421
This commit is contained in:
parent
af3ced3b9c
commit
217812fa9e
@ -43,7 +43,9 @@
|
||||
#include "memdebug.h"
|
||||
|
||||
/* #define DEBUG_NGTCP2 */
|
||||
#ifdef CURLDEBUG
|
||||
#define DEBUG_HTTP3
|
||||
#endif
|
||||
#ifdef DEBUG_HTTP3
|
||||
#define H3BUGF(x) x
|
||||
#else
|
||||
@ -204,7 +206,7 @@ static int quic_add_handshake_data(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level,
|
||||
qs->qconn, level, (uint8_t *)(&crypto_data->buf[crypto_data->len] - len),
|
||||
len);
|
||||
if(rv) {
|
||||
fprintf(stderr, "write_client_handshake failed\n");
|
||||
H3BUGF(fprintf(stderr, "write_client_handshake failed\n"));
|
||||
}
|
||||
assert(0 == rv);
|
||||
|
||||
@ -597,12 +599,11 @@ CURLcode Curl_quic_connect(struct connectdata *conn,
|
||||
|
||||
ngtcp2_conn_get_local_transport_params(qs->qconn, ¶ms);
|
||||
nwrite = ngtcp2_encode_transport_params(
|
||||
paramsbuf, sizeof(paramsbuf), NGTCP2_TRANSPORT_PARAMS_TYPE_CLIENT_HELLO,
|
||||
¶ms);
|
||||
paramsbuf, sizeof(paramsbuf), NGTCP2_TRANSPORT_PARAMS_TYPE_CLIENT_HELLO,
|
||||
¶ms);
|
||||
if(nwrite < 0) {
|
||||
fprintf(stderr, "ngtcp2_encode_transport_params: %s\n",
|
||||
ngtcp2_strerror((int)nwrite));
|
||||
|
||||
failf(data, "ngtcp2_encode_transport_params: %s\n",
|
||||
ngtcp2_strerror((int)nwrite));
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
@ -699,7 +700,7 @@ static int cb_h3_stream_close(nghttp3_conn *conn, int64_t stream_id,
|
||||
(void)stream_id;
|
||||
(void)app_error_code;
|
||||
(void)user_data;
|
||||
fprintf(stderr, "cb_h3_stream_close CALLED\n");
|
||||
H3BUGF(infof(data, "cb_h3_stream_close CALLED\n"));
|
||||
|
||||
stream->closed = TRUE;
|
||||
Curl_expire(data, 0, EXPIRE_QUIC);
|
||||
@ -715,7 +716,7 @@ static int cb_h3_recv_data(nghttp3_conn *conn, int64_t stream_id,
|
||||
struct Curl_easy *data = stream_user_data;
|
||||
struct HTTP *stream = data->req.protop;
|
||||
(void)conn;
|
||||
fprintf(stderr, "cb_h3_recv_data CALLED with %d bytes\n", buflen);
|
||||
H3BUGF(infof(data, "cb_h3_recv_data CALLED with %d bytes\n", buflen));
|
||||
|
||||
/* TODO: this needs to be handled properly */
|
||||
DEBUGASSERT(buflen <= stream->len);
|
||||
@ -749,7 +750,6 @@ static int cb_h3_deferred_consume(nghttp3_conn *conn, int64_t stream_id,
|
||||
struct quicsocket *qs = user_data;
|
||||
(void)conn;
|
||||
(void)stream_user_data;
|
||||
fprintf(stderr, "cb_h3_deferred_consume CALLED\n");
|
||||
|
||||
ngtcp2_conn_extend_max_stream_offset(qs->qconn, stream_id, consumed);
|
||||
ngtcp2_conn_extend_max_offset(qs->qconn, consumed);
|
||||
@ -818,8 +818,6 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t stream_id,
|
||||
(void)flags;
|
||||
(void)user_data;
|
||||
|
||||
fprintf(stderr, "cb_h3_recv_header called!\n");
|
||||
|
||||
if(h3name.len == sizeof(":status") - 1 &&
|
||||
!memcmp(":status", h3name.base, h3name.len)) {
|
||||
int status = decode_status_code(h3val.base, h3val.len);
|
||||
@ -849,7 +847,6 @@ static int cb_h3_send_stop_sending(nghttp3_conn *conn, int64_t stream_id,
|
||||
(void)app_error_code;
|
||||
(void)user_data;
|
||||
(void)stream_user_data;
|
||||
fprintf(stderr, "cb_h3_send_stop_sending CALLED\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -947,9 +944,6 @@ static ssize_t ngh3_stream_recv(struct connectdata *conn,
|
||||
struct HTTP *stream = conn->data->req.protop;
|
||||
struct quicsocket *qs = conn->quic;
|
||||
|
||||
fprintf(stderr, "ngh3_stream_recv CALLED (easy %p, socket %d)\n",
|
||||
conn->data, sockfd);
|
||||
|
||||
if(!stream->memlen) {
|
||||
/* remember where to store incoming data for this stream and how big the
|
||||
buffer is */
|
||||
@ -1003,8 +997,9 @@ static int cb_h3_acked_stream_data(nghttp3_conn *conn, int64_t stream_id,
|
||||
|
||||
if(!data->set.postfields) {
|
||||
stream->h3out->used -= datalen;
|
||||
fprintf(stderr, "cb_h3_acked_stream_data, %zd bytes, %zd left unacked\n",
|
||||
datalen, stream->h3out->used);
|
||||
H3BUGF(infof(data,
|
||||
"cb_h3_acked_stream_data, %zd bytes, %zd left unacked\n",
|
||||
datalen, stream->h3out->used));
|
||||
DEBUGASSERT(stream->h3out->used < H3_SEND_SIZE);
|
||||
}
|
||||
return 0;
|
||||
@ -1057,9 +1052,9 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
|
||||
if(!stream->upload_left)
|
||||
*pflags = NGHTTP3_DATA_FLAG_EOF;
|
||||
}
|
||||
fprintf(stderr, "cb_h3_readfunction %zd bytes%s (at %zd unacked)\n",
|
||||
nread, *pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
|
||||
out->used);
|
||||
H3BUGF(infof(data, "cb_h3_readfunction %zd bytes%s (at %zd unacked)\n",
|
||||
nread, *pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
|
||||
out->used));
|
||||
}
|
||||
if(stream->upload_done && !stream->upload_len &&
|
||||
(stream->upload_left <= 0)) {
|
||||
@ -1333,7 +1328,8 @@ static ssize_t ngh3_stream_send(struct connectdata *conn,
|
||||
sent = len;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "ngh3_stream_send() wants to send %zd bytes\n", len);
|
||||
H3BUGF(infof(conn->data, "ngh3_stream_send() wants to send %zd bytes\n",
|
||||
len));
|
||||
if(!stream->upload_len) {
|
||||
stream->upload_mem = mem;
|
||||
stream->upload_len = len;
|
||||
@ -1590,8 +1586,6 @@ CURLcode Curl_quic_done_sending(struct connectdata *conn)
|
||||
/* only for HTTP/3 transfers */
|
||||
struct HTTP *stream = conn->data->req.protop;
|
||||
struct quicsocket *qs = conn->quic;
|
||||
fprintf(stderr, "!!! Curl_quic_done_sending stream %zu\n",
|
||||
stream->stream3_id);
|
||||
stream->upload_done = TRUE;
|
||||
(void)nghttp3_conn_resume_stream(qs->h3conn, stream->stream3_id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user