Fix in-class initialization for windows build

This commit is contained in:
Atlante45 2015-09-24 15:00:55 +02:00
parent 48ff912dd2
commit 1f07ba46d0
2 changed files with 11 additions and 5 deletions

View file

@ -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<int, NumEvents>;
microseconds startTime;
microseconds endTime;
// construct a vector for the events of the size of our Enum - default value is zero
std::array<int, (int) Event::NumEvents> 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();

View file

@ -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 };
};