diff --git a/src/Syroot.Worms.Mgame.GameServer/Client.WorldPartyAqua.Server.cs b/src/Syroot.Worms.Mgame.GameServer/Client.WorldPartyAqua.Server.cs index 370b530..5976a7a 100644 --- a/src/Syroot.Worms.Mgame.GameServer/Client.WorldPartyAqua.Server.cs +++ b/src/Syroot.Worms.Mgame.GameServer/Client.WorldPartyAqua.Server.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Threading.Tasks; using Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua; using Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Server; @@ -6,6 +7,10 @@ namespace Syroot.Worms.Mgame.GameServer { internal partial class Client { + // ---- FIELDS ------------------------------------------------------------------------------------------------- + + private int _sendConnectTries; + // ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- public void HandleWwpaServerChannelList(ChannelListQuery packet) @@ -81,16 +86,23 @@ namespace Syroot.Worms.Mgame.GameServer }); } - public void HandleWwpaServerConnect(ConnectQuery packet) + public async void HandleWwpaServerConnect(ConnectQuery packet) { - // Client fails to detect reply at rare times due to unknown reasons. - SendPacket(new ConnectReply { ServerVersion = _server.Config.Version }); + // Client fails to detect reply at rare times due to unknown reasons. Resend packet some times. + ConnectReply reply = new ConnectReply { ServerVersion = _server.Config.Version }; + _sendConnectTries = 10; + while (_sendConnectTries-- > 0) + { + SendPacket(reply); + await Task.Delay(500); + } } public void HandleWwpaServerDisconnect(DisconnectNotice packet) { } public void HandleWwpaServerLogin(LoginQuery packet) { + _sendConnectTries = 0; SendPacket(new LoginReply { Result = LoginResult.Success }); }