Fix a couple of small bugs that crept in in previous commit

This commit is contained in:
Dmitri Tikhonov 2019-04-12 13:44:40 -04:00
parent 55cd0b38b2
commit 9b4d33c76c
2 changed files with 8 additions and 4 deletions

View file

@ -74,7 +74,8 @@ lsquic_qlog_create_connection (lsquic_cid_t cid,
lsquic_time_now(), ip_version, srcip, dstip, srcport, dstport); lsquic_time_now(), ip_version, srcip, dstip, srcport, dstport);
} }
#define QLOG_FRAME_DICT_PREFIX ",{\"frame_type\":\"" #define QLOG_FRAME_DICT_PREFIX_COMMA ",{\"frame_type\":\""
#define QLOG_FRAME_DICT_PREFIX "{\"frame_type\":\""
#define QLOG_FRAME_DICT_SUFFIX "\"}" #define QLOG_FRAME_DICT_SUFFIX "\"}"
#define QLOG_FRAME_LIST_PREFIX ",\"frames\":[" #define QLOG_FRAME_LIST_PREFIX ",\"frames\":["
#define QLOG_FRAME_LIST_SUFFIX "]" #define QLOG_FRAME_LIST_SUFFIX "]"
@ -83,7 +84,7 @@ lsquic_qlog_create_connection (lsquic_cid_t cid,
sizeof(QLOG_FRAME_LIST_SUFFIX) + \ sizeof(QLOG_FRAME_LIST_SUFFIX) + \
lsquic_frame_types_str_sz + \ lsquic_frame_types_str_sz + \
(N_QUIC_FRAMES * \ (N_QUIC_FRAMES * \
(sizeof(QLOG_FRAME_DICT_PREFIX) + \ (sizeof(QLOG_FRAME_DICT_PREFIX_COMMA) + \
sizeof(QLOG_FRAME_DICT_SUFFIX))) sizeof(QLOG_FRAME_DICT_SUFFIX)))
void void
@ -112,7 +113,9 @@ lsquic_qlog_packet_rx (lsquic_cid_t cid,
/* prefix + FRAME_NAME + suffix */ /* prefix + FRAME_NAME + suffix */
"%s%s%s", "%s%s%s",
/* skip comma in prefix if first frame */ /* skip comma in prefix if first frame */
QLOG_FRAME_DICT_PREFIX + (first++ ? 0 : 1), (first++ ?
QLOG_FRAME_DICT_PREFIX_COMMA :
QLOG_FRAME_DICT_PREFIX),
QUIC_FRAME_NAME(i), QUIC_FRAME_NAME(i),
QLOG_FRAME_DICT_SUFFIX); QLOG_FRAME_DICT_SUFFIX);
if ((unsigned)ret > QLOG_FRAME_LIST_MAX - cur) if ((unsigned)ret > QLOG_FRAME_LIST_MAX - cur)
@ -132,7 +135,7 @@ lsquic_qlog_packet_rx (lsquic_cid_t cid,
"\"header\":{" "\"header\":{"
"\"type\":\"%s\"," "\"type\":\"%s\","
"\"payload_length\":\"%d\"," "\"payload_length\":\"%d\","
"\"packet_number\":\"%ld\"" "\"packet_number\":\"%" PRIu64 "\""
"}%s" "}%s"
"}]", "}]",
packet_in->pi_received, packet_in->pi_received,

View file

@ -17,6 +17,7 @@
int int
main (void) main (void)
{ {
lsquic_global_init(LSQUIC_GLOBAL_CLIENT | LSQUIC_GLOBAL_CLIENT);
lsquic_log_to_fstream(stderr, LLTS_HHMMSSMS); lsquic_log_to_fstream(stderr, LLTS_HHMMSSMS);
lsquic_set_log_level("debug"); lsquic_set_log_level("debug");