diff --git a/libraries/networking/src/udt/ConnectionStats.h b/libraries/networking/src/udt/ConnectionStats.h index 8163ed5250..84cd6b2486 100644 --- a/libraries/networking/src/udt/ConnectionStats.h +++ b/libraries/networking/src/udt/ConnectionStats.h @@ -20,9 +20,6 @@ namespace udt { class ConnectionStats { public: struct Stats { - std::chrono::microseconds startTime; - std::chrono::microseconds endTime; - enum Event { SentACK, ReceivedACK, @@ -41,8 +38,14 @@ public: NumEvents }; + using microseconds = std::chrono::microseconds; + using Events = std::array; + + microseconds startTime; + microseconds endTime; + // construct a vector for the events of the size of our Enum - default value is zero - std::array events {{ 0 }}; + Events events; // packet counts and sizes int sentPackets { 0 }; @@ -66,6 +69,9 @@ public: int rtt { 0 }; int congestionWindowSize { 0 }; int packetSendPeriod { 0 }; + + // TODO: Remove once Win build supports brace initialization: `Events events {{ 0 }};` + Stats() { events.fill(0); } }; ConnectionStats(); diff --git a/libraries/networking/src/udt/PacketQueue.h b/libraries/networking/src/udt/PacketQueue.h index f3d925af30..69784fd8db 100644 --- a/libraries/networking/src/udt/PacketQueue.h +++ b/libraries/networking/src/udt/PacketQueue.h @@ -49,7 +49,7 @@ private: MessageNumber _currentMessageNumber { 0 }; mutable Mutex _packetsLock; // Protects the packets to be sent. - Channels _channels { 1 }; // One channel per packet list + Channels _channels = Channels(1); // One channel per packet list + Main channel unsigned int _currentIndex { 0 }; };