From ad08470cea073b75a3125f207ef9fdb3e90fd26e Mon Sep 17 00:00:00 2001 From: Dmitri Tikhonov Date: Fri, 11 Oct 2019 08:24:24 -0400 Subject: [PATCH] Release 2.4.6 - Minor code cleanup and logging improvements. - Server and client programs: include library version (e.g. 2.4.6) into `server' and `user-agent' headers. --- CHANGELOG | 6 ++++++ include/lsquic.h | 2 +- src/liblsquic/lsquic_attq.c | 1 + src/liblsquic/lsquic_full_conn.c | 30 +++++++++++++++++++++++++-- src/liblsquic/lsquic_full_conn_ietf.c | 2 -- src/liblsquic/lsquic_stream.c | 6 ++++++ src/liblsquic/lsquic_varint.c | 1 - test/http_client.c | 1 + test/http_server.c | 2 +- test/test_common.h | 5 +++++ test/unittests/test_attq.c | 6 ++++++ 11 files changed, 55 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3913a1a82..7a5bef834 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +2019-10-11 + - 2.4.6 + - Minor code cleanup and logging improvements. + - Server and client programs: include library version (e.g. 2.4.6) + into `server' and `user-agent' headers. + 2019-10-08 - 2.4.5 - [OPTIMIZATION]: flush encoder stream only when necessary. diff --git a/include/lsquic.h b/include/lsquic.h index 4847b697f..417e583ed 100644 --- a/include/lsquic.h +++ b/include/lsquic.h @@ -25,7 +25,7 @@ extern "C" { #define LSQUIC_MAJOR_VERSION 2 #define LSQUIC_MINOR_VERSION 4 -#define LSQUIC_PATCH_VERSION 5 +#define LSQUIC_PATCH_VERSION 6 /** * Engine flags: diff --git a/src/liblsquic/lsquic_attq.c b/src/liblsquic/lsquic_attq.c index ee5bb8524..9720a7fa0 100644 --- a/src/liblsquic/lsquic_attq.c +++ b/src/liblsquic/lsquic_attq.c @@ -252,6 +252,7 @@ attq_count_before (struct attq *q, lsquic_time_t cutoff) return total_count; } assert(0); + return total_count; } diff --git a/src/liblsquic/lsquic_full_conn.c b/src/liblsquic/lsquic_full_conn.c index 2a5ec4bf8..446af2be4 100644 --- a/src/liblsquic/lsquic_full_conn.c +++ b/src/liblsquic/lsquic_full_conn.c @@ -4211,19 +4211,32 @@ full_conn_ci_is_tickable (lsquic_conn_t *lconn) struct lsquic_stream *stream; if (!TAILQ_EMPTY(&conn->fc_pub.service_streams)) + { + LSQ_DEBUG("tickable: there are streams to be serviced"); return 1; + } if ((conn->fc_enpub->enp_flags & ENPUB_CAN_SEND) && (should_generate_ack(conn) || !lsquic_send_ctl_sched_is_blocked(&conn->fc_send_ctl))) { - if (conn->fc_flags & (FC_SEND_GOAWAY|FC_SEND_STOP_WAITING - |FC_SEND_PING|FC_SEND_WUF|FC_CLOSING)) + const enum full_conn_flags send_flags = FC_SEND_GOAWAY + |FC_SEND_STOP_WAITING|FC_SEND_PING|FC_SEND_WUF|FC_CLOSING; + if (conn->fc_flags & send_flags) + { + LSQ_DEBUG("tickable: flags: 0x%X", conn->fc_flags & send_flags); goto check_can_send; + } if (lsquic_send_ctl_has_buffered(&conn->fc_send_ctl)) + { + LSQ_DEBUG("tickable: has buffered packets"); goto check_can_send; + } if (!TAILQ_EMPTY(&conn->fc_pub.sending_streams)) + { + LSQ_DEBUG("tickable: there are sending streams"); goto check_can_send; + } if ((conn->fc_conn.cn_flags & LSCONN_HANDSHAKE_DONE) || conn->fc_conn.cn_esf_c->esf_is_zero_rtt_enabled( conn->fc_conn.cn_enc_session)) @@ -4231,7 +4244,11 @@ full_conn_ci_is_tickable (lsquic_conn_t *lconn) TAILQ_FOREACH(stream, &conn->fc_pub.write_streams, next_write_stream) if (lsquic_stream_write_avail(stream)) + { + LSQ_DEBUG("tickable: stream %"PRIu64" can be written to", + stream->id); goto check_can_send; + } } else { @@ -4239,7 +4256,11 @@ full_conn_ci_is_tickable (lsquic_conn_t *lconn) next_write_stream) if (LSQUIC_GQUIC_STREAM_HANDSHAKE == stream->id && lsquic_stream_write_avail(stream)) + { + LSQ_DEBUG("tickable: stream %"PRIu64" can be written to", + stream->id); goto check_can_send; + } } goto check_readable_streams; check_can_send: @@ -4250,8 +4271,13 @@ full_conn_ci_is_tickable (lsquic_conn_t *lconn) check_readable_streams: TAILQ_FOREACH(stream, &conn->fc_pub.read_streams, next_read_stream) if (lsquic_stream_readable(stream)) + { + LSQ_DEBUG("tickable: stream %"PRIu64" can be read from", + stream->id); return 1; + } + LSQ_DEBUG("not tickable"); return 0; } diff --git a/src/liblsquic/lsquic_full_conn_ietf.c b/src/liblsquic/lsquic_full_conn_ietf.c index af3f6264f..0263cc0ce 100644 --- a/src/liblsquic/lsquic_full_conn_ietf.c +++ b/src/liblsquic/lsquic_full_conn_ietf.c @@ -1213,8 +1213,6 @@ lsquic_ietf_full_conn_server_new (struct lsquic_engine_public *enpub, = imc->imc_largest_recvd[pns]; } - /* TODO: Transfer incoming packets. */ - /* Mini connection sends out packets 0, 1, 2... and so on. It deletes * packets that have been successfully sent and acked or those that have * been lost. We take ownership of all packets in mc_packets_out; those diff --git a/src/liblsquic/lsquic_stream.c b/src/liblsquic/lsquic_stream.c index 019643c13..9d51ce81c 100644 --- a/src/liblsquic/lsquic_stream.c +++ b/src/liblsquic/lsquic_stream.c @@ -205,6 +205,10 @@ enum stream_history_event SHE_CLOSE = 'X', SHE_DELAY_SW = 'y', SHE_FORCE_FINISH = 'Z', + SHE_WANTREAD_NO = '0', /* "YES" must be one more than "NO" */ + SHE_WANTREAD_YES = '1', + SHE_WANTWRITE_NO = '2', + SHE_WANTWRITE_YES = '3', }; static void @@ -1741,6 +1745,7 @@ stream_wantwrite (struct lsquic_stream *stream, int new_val) int lsquic_stream_wantread (lsquic_stream_t *stream, int is_want) { + SM_HISTORY_APPEND(stream, SHE_WANTREAD_NO + !!is_want); if (!(stream->stream_flags & STREAM_U_READ_DONE)) { if (is_want) @@ -1762,6 +1767,7 @@ lsquic_stream_wantwrite (lsquic_stream_t *stream, int is_want) is_want = !!is_want; + SM_HISTORY_APPEND(stream, SHE_WANTWRITE_NO + is_want); if (0 == (stream->stream_flags & STREAM_U_WRITE_DONE) && SSHS_BEGIN == stream->sm_send_headers_state) { diff --git a/src/liblsquic/lsquic_varint.c b/src/liblsquic/lsquic_varint.c index 1c752b061..be0333894 100644 --- a/src/liblsquic/lsquic_varint.c +++ b/src/liblsquic/lsquic_varint.c @@ -54,7 +54,6 @@ lsquic_varint_read (const unsigned char *p, const unsigned char *end, *valp = val; return 8; } - assert(0); } diff --git a/test/http_client.c b/test/http_client.c index 7153b7741..148fb4b33 100644 --- a/test/http_client.c +++ b/test/http_client.c @@ -1533,6 +1533,7 @@ main (int argc, char **argv) #if LSQUIC_CONN_STATS prog.prog_api.ea_stats_fh = stats_fh; #endif + prog.prog_settings.es_ua = LITESPEED_ID; if (client_ctx.qif_file) { diff --git a/test/http_server.c b/test/http_server.c index d99422808..1141f0ff6 100644 --- a/test/http_server.c +++ b/test/http_server.c @@ -954,7 +954,7 @@ send_headers2 (struct lsquic_stream *stream, struct lsquic_stream_ctx *st_h, }, { .name = { .iov_base = "server", .iov_len = 6, }, - .value = { .iov_base = "LiteSpeed", .iov_len = 9, }, + .value = { .iov_base = LITESPEED_ID, .iov_len = sizeof(LITESPEED_ID) - 1, }, }, { .name = { .iov_base = "content-type", .iov_len = 12, }, diff --git a/test/test_common.h b/test/test_common.h index 6ae93e09b..43a452380 100644 --- a/test/test_common.h +++ b/test/test_common.h @@ -120,4 +120,9 @@ create_lsquic_reader_ctx (const char *filename); void destroy_lsquic_reader_ctx (struct reader_ctx *ctx); +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) +#define LITESPEED_ID "lsquic" "/" TOSTRING(LSQUIC_MAJOR_VERSION) "." \ + TOSTRING(LSQUIC_MINOR_VERSION) "." TOSTRING(LSQUIC_PATCH_VERSION) + #endif diff --git a/test/unittests/test_attq.c b/test/unittests/test_attq.c index 90098d4fe..0979b32fb 100644 --- a/test/unittests/test_attq.c +++ b/test/unittests/test_attq.c @@ -79,6 +79,12 @@ test_attq_ordering (enum sort_action sa) q = attq_create(); + for (i = 0; i < sizeof(curiosity); ++i) + { + unsigned count_before = attq_count_before(q, curiosity[i]); + assert(count_before == 0); + } + conns = calloc(sizeof(curiosity), sizeof(conns[0])); for (i = 0; i < sizeof(curiosity); ++i) {