mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-01-13 07:18:00 +03:00
Try to fix failing connects.
This commit is contained in:
parent
1b527a3f20
commit
e9c88caadc
@ -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 });
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user