TraversalClient: In-class initialize members where applicable
This commit is contained in:
parent
ca6a2970ea
commit
1b8ad49d1e
|
@ -22,8 +22,7 @@ static void GetRandomishBytes(u8* buf, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
TraversalClient::TraversalClient(ENetHost* netHost, const std::string& server, const u16 port)
|
TraversalClient::TraversalClient(ENetHost* netHost, const std::string& server, const u16 port)
|
||||||
: m_NetHost(netHost), m_Client(nullptr), m_ConnectRequestId(0), m_PendingConnect(false),
|
: m_NetHost(netHost), m_Server(server), m_port(port)
|
||||||
m_Server(server), m_port(port), m_PingTime(0)
|
|
||||||
{
|
{
|
||||||
netHost->intercept = TraversalClient::InterceptCallback;
|
netHost->intercept = TraversalClient::InterceptCallback;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
bool TestPacket(u8* data, size_t size, ENetAddress* from);
|
bool TestPacket(u8* data, size_t size, ENetAddress* from);
|
||||||
void HandleResends();
|
void HandleResends();
|
||||||
|
|
||||||
TraversalClientClient* m_Client;
|
TraversalClientClient* m_Client = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct OutgoingTraversalPacketInfo
|
struct OutgoingTraversalPacketInfo
|
||||||
|
@ -71,16 +71,16 @@ private:
|
||||||
static int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
|
static int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
|
||||||
|
|
||||||
ENetHost* m_NetHost;
|
ENetHost* m_NetHost;
|
||||||
TraversalHostId m_HostId;
|
TraversalHostId m_HostId{};
|
||||||
State m_State;
|
State m_State{};
|
||||||
FailureReason m_FailureReason;
|
FailureReason m_FailureReason{};
|
||||||
TraversalRequestId m_ConnectRequestId;
|
TraversalRequestId m_ConnectRequestId = 0;
|
||||||
bool m_PendingConnect;
|
bool m_PendingConnect = false;
|
||||||
std::list<OutgoingTraversalPacketInfo> m_OutgoingTraversalPackets;
|
std::list<OutgoingTraversalPacketInfo> m_OutgoingTraversalPackets;
|
||||||
ENetAddress m_ServerAddress;
|
ENetAddress m_ServerAddress{};
|
||||||
std::string m_Server;
|
std::string m_Server;
|
||||||
u16 m_port;
|
u16 m_port;
|
||||||
enet_uint32 m_PingTime;
|
enet_uint32 m_PingTime = 0;
|
||||||
};
|
};
|
||||||
extern std::unique_ptr<TraversalClient> g_TraversalClient;
|
extern std::unique_ptr<TraversalClient> g_TraversalClient;
|
||||||
// the NetHost connected to the TraversalClient.
|
// the NetHost connected to the TraversalClient.
|
||||||
|
|
Loading…
Reference in New Issue