Skip to content

Commit 509f3ca

Browse files
Johan511nibanks
andauthored
Apply suggestions from code review
Co-authored-by: Nick Banks <nibanks@microsoft.com>
1 parent 2427212 commit 509f3ca

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

src/core/connection.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6912,26 +6912,19 @@ QuicConnGetNetworkStatistics(
69126912
NETWORK_STATISTICS* Stats
69136913
)
69146914
{
6915-
const uint32_t MinimumStatsSize = sizeof(NETWORK_STATISTICS);
6916-
6917-
if (*StatsLength == 0) {
6915+
if (*StatsLength < sizeof(NETWORK_STATISTICS)) {
69186916
*StatsLength = sizeof(NETWORK_STATISTICS);
69196917
return QUIC_STATUS_BUFFER_TOO_SMALL;
69206918
}
69216919

6922-
if (*StatsLength < MinimumStatsSize) {
6923-
*StatsLength = MinimumStatsSize;
6924-
return QUIC_STATUS_BUFFER_TOO_SMALL;
6925-
}
6926-
69276920
if (Stats == NULL) {
69286921
return QUIC_STATUS_INVALID_PARAMETER;
69296922
}
69306923

69316924
memset(Stats, 0, MinimumStatsSize);
69326925

69336926
Connection->CongestionControl.QuicCongestionControlGetNetworkStatistics(
6934-
Connection, &Connection->CongestionControl, Stats);
6927+
Connection, &Connection->CongestionControl, Stats);
69356928

69366929
return QUIC_STATUS_SUCCESS;
69376930
}

src/inc/msquic.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -643,12 +643,12 @@ typedef struct QUIC_STATISTICS_V2 {
643643

644644
typedef struct NETWORK_STATISTICS
645645
{
646-
uint32_t BytesInFlight; // Bytes that were sent on the wire, but not yet acked
647-
uint64_t PostedBytes; // Total bytes queued, but not yet acked. These may contain sent bytes that may have potentially lost too.
648-
uint64_t IdealBytes; // Ideal number of bytes required to be available to avoid limiting throughput
649-
uint64_t SmoothedRTT; // Smoothed RTT value
650-
uint32_t CongestionWindow; // Congestion Window
651-
uint64_t Bandwidth; // Estimated bandwidth
646+
uint32_t BytesInFlight; // Bytes that were sent on the wire, but not yet acked
647+
uint64_t PostedBytes; // Total bytes queued, but not yet acked. These may contain sent bytes that may have potentially lost too.
648+
uint64_t IdealBytes; // Ideal number of bytes required to be available to avoid limiting throughput
649+
uint64_t SmoothedRTT; // Smoothed RTT value
650+
uint32_t CongestionWindow; // Congestion Window
651+
uint64_t Bandwidth; // Estimated bandwidth
652652

653653
} NETWORK_STATISTICS;
654654

@@ -1022,7 +1022,6 @@ typedef struct QUIC_SCHANNEL_CREDENTIAL_ATTRIBUTE_W {
10221022
#define QUIC_PARAM_CONN_STATISTICS_V2_PLAT 0x05000017 // QUIC_STATISTICS_V2
10231023
#define QUIC_PARAM_CONN_ORIG_DEST_CID 0x05000018 // uint8_t[]
10241024
#define QUIC_PARAM_CONN_SEND_DSCP 0x05000019 // uint8_t
1025-
10261025
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
10271026
#define QUIC_PARAM_CONN_NETWORK_STATISTICS 0x05000020 // struct NETWORK_STATISTICS
10281027
#endif

0 commit comments

Comments
 (0)