TraversalClient: In-class initialize members where applicable

This commit is contained in:
Lioncash 2018-04-16 16:24:09 -04:00
parent ca6a2970ea
commit 1b8ad49d1e
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7
2 changed files with 9 additions and 10 deletions

View File

@ -22,8 +22,7 @@ static void GetRandomishBytes(u8* buf, size_t size)
}
TraversalClient::TraversalClient(ENetHost* netHost, const std::string& server, const u16 port)
: m_NetHost(netHost), m_Client(nullptr), m_ConnectRequestId(0), m_PendingConnect(false),
m_Server(server), m_port(port), m_PingTime(0)
: m_NetHost(netHost), m_Server(server), m_port(port)
{
netHost->intercept = TraversalClient::InterceptCallback;

View File

@ -54,7 +54,7 @@ public:
bool TestPacket(u8* data, size_t size, ENetAddress* from);
void HandleResends();
TraversalClientClient* m_Client;
TraversalClientClient* m_Client = nullptr;
private:
struct OutgoingTraversalPacketInfo
@ -71,16 +71,16 @@ private:
static int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
ENetHost* m_NetHost;
TraversalHostId m_HostId;
State m_State;
FailureReason m_FailureReason;
TraversalRequestId m_ConnectRequestId;
bool m_PendingConnect;
TraversalHostId m_HostId{};
State m_State{};
FailureReason m_FailureReason{};
TraversalRequestId m_ConnectRequestId = 0;
bool m_PendingConnect = false;
std::list<OutgoingTraversalPacketInfo> m_OutgoingTraversalPackets;
ENetAddress m_ServerAddress;
ENetAddress m_ServerAddress{};
std::string m_Server;
u16 m_port;
enet_uint32 m_PingTime;
enet_uint32 m_PingTime = 0;
};
extern std::unique_ptr<TraversalClient> g_TraversalClient;
// the NetHost connected to the TraversalClient.