diff --git a/Source/Core/Common/TraversalClient.h b/Source/Core/Common/TraversalClient.h index d322761ffd..9d61680771 100644 --- a/Source/Core/Common/TraversalClient.h +++ b/Source/Core/Common/TraversalClient.h @@ -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 diff --git a/Source/Core/Common/TraversalProto.h b/Source/Core/Common/TraversalProto.h index 828d782626..95ef2bb994 100644 --- a/Source/Core/Common/TraversalProto.h +++ b/Source/Core/Common/TraversalProto.h @@ -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; }; }; diff --git a/Source/Core/Common/TraversalServer.cpp b/Source/Core/Common/TraversalServer.cpp index 80d32d52fa..2c383bcbd7 100644 --- a/Source/Core/Common/TraversalServer.cpp +++ b/Source/Core/Common/TraversalServer.cpp @@ -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 { diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 2ebc2e7a50..f144f77c52 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -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: diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h index cced924dbb..c0ab68f7f0 100644 --- a/Source/Core/Core/NetPlayClient.h +++ b/Source/Core/Core/NetPlayClient.h @@ -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; diff --git a/Source/Core/Core/NetPlayServer.h b/Source/Core/Core/NetPlayServer.h index 16034074af..67819be9bf 100644 --- a/Source/Core/Core/NetPlayServer.h +++ b/Source/Core/Core/NetPlayServer.h @@ -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> GetInterfaceListInternal() const;