TraversalProto: Convert TraversalConnectFailedReason into an enum class
This commit is contained in:
parent
2021175809
commit
2f0fb2056e
|
@ -19,7 +19,7 @@ public:
|
|||
virtual ~TraversalClientClient() = default;
|
||||
virtual void OnTraversalStateChanged() = 0;
|
||||
virtual void OnConnectReady(ENetAddress addr) = 0;
|
||||
virtual void OnConnectFailed(u8 reason) = 0;
|
||||
virtual void OnConnectFailed(TraversalConnectFailedReason reason) = 0;
|
||||
};
|
||||
|
||||
class TraversalClient
|
||||
|
|
|
@ -34,11 +34,11 @@ enum
|
|||
TraversalProtoVersion = 0
|
||||
};
|
||||
|
||||
enum TraversalConnectFailedReason
|
||||
enum class TraversalConnectFailedReason : u8
|
||||
{
|
||||
TraversalConnectFailedClientDidntRespond = 0,
|
||||
TraversalConnectFailedClientFailure,
|
||||
TraversalConnectFailedNoSuchClient
|
||||
ClientDidntRespond = 0,
|
||||
ClientFailure,
|
||||
NoSuchClient,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
@ -88,7 +88,7 @@ struct TraversalPacket
|
|||
struct
|
||||
{
|
||||
TraversalRequestId requestId;
|
||||
u8 reason;
|
||||
TraversalConnectFailedReason reason;
|
||||
} connectFailed;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -247,7 +247,7 @@ static void ResendPackets()
|
|||
TraversalPacket* fail = AllocPacket(MakeSinAddr(p.first));
|
||||
fail->type = TraversalPacketConnectFailed;
|
||||
fail->connectFailed.requestId = p.second;
|
||||
fail->connectFailed.reason = TraversalConnectFailedClientDidntRespond;
|
||||
fail->connectFailed.reason = TraversalConnectFailedReason::ClientDidntRespond;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ static void HandlePacket(TraversalPacket* packet, sockaddr_in6* addr)
|
|||
{
|
||||
ready->type = TraversalPacketConnectFailed;
|
||||
ready->connectFailed.requestId = info->misc;
|
||||
ready->connectFailed.reason = TraversalConnectFailedClientFailure;
|
||||
ready->connectFailed.reason = TraversalConnectFailedReason::ClientFailure;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ static void HandlePacket(TraversalPacket* packet, sockaddr_in6* addr)
|
|||
TraversalPacket* reply = AllocPacket(*addr);
|
||||
reply->type = TraversalPacketConnectFailed;
|
||||
reply->connectFailed.requestId = packet->requestId;
|
||||
reply->connectFailed.reason = TraversalConnectFailedNoSuchClient;
|
||||
reply->connectFailed.reason = TraversalConnectFailedReason::NoSuchClient;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1780,19 +1780,19 @@ void NetPlayClient::OnConnectReady(ENetAddress addr)
|
|||
}
|
||||
|
||||
// called from ---NETPLAY--- thread
|
||||
void NetPlayClient::OnConnectFailed(u8 reason)
|
||||
void NetPlayClient::OnConnectFailed(TraversalConnectFailedReason reason)
|
||||
{
|
||||
m_connecting = false;
|
||||
m_connection_state = ConnectionState::Failure;
|
||||
switch (reason)
|
||||
{
|
||||
case TraversalConnectFailedClientDidntRespond:
|
||||
case TraversalConnectFailedReason::ClientDidntRespond:
|
||||
PanicAlertFmtT("Traversal server timed out connecting to the host");
|
||||
break;
|
||||
case TraversalConnectFailedClientFailure:
|
||||
case TraversalConnectFailedReason::ClientFailure:
|
||||
PanicAlertFmtT("Server rejected traversal attempt");
|
||||
break;
|
||||
case TraversalConnectFailedNoSuchClient:
|
||||
case TraversalConnectFailedReason::NoSuchClient:
|
||||
PanicAlertFmtT("Invalid host");
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
|
||||
void OnTraversalStateChanged() override;
|
||||
void OnConnectReady(ENetAddress addr) override;
|
||||
void OnConnectFailed(u8 reason) override;
|
||||
void OnConnectFailed(TraversalConnectFailedReason reason) override;
|
||||
|
||||
bool IsFirstInGamePad(int ingame_pad) const;
|
||||
int NumLocalPads() const;
|
||||
|
|
|
@ -134,7 +134,7 @@ private:
|
|||
|
||||
void OnTraversalStateChanged() override;
|
||||
void OnConnectReady(ENetAddress) override {}
|
||||
void OnConnectFailed(u8) override {}
|
||||
void OnConnectFailed(TraversalConnectFailedReason) override {}
|
||||
void UpdatePadMapping();
|
||||
void UpdateWiimoteMapping();
|
||||
std::vector<std::pair<std::string, std::string>> GetInterfaceListInternal() const;
|
||||
|
|
Loading…
Reference in New Issue