This commit is contained in:
Mister_Nebula 2022-08-26 20:31:49 +01:00
parent b46a45e346
commit 849b6d1e7e
3 changed files with 19 additions and 3 deletions

View File

@ -120,6 +120,8 @@ public abstract class Common
protected void SendInternal(ProductUserId target, SocketId socketId, InternalMessages type)
{
Debug.LogError($"SendInternal type:{type} to {target}");
EOSSDKComponent.GetP2PInterface().SendPacket(new SendPacketOptions()
{
AllowDelayedDelivery = true,

View File

@ -67,14 +67,19 @@ public class Server : Common
protected override void OnReceiveInternalData(InternalMessages type, ProductUserId clientUserId, SocketId socketId)
{
Debug.LogError($"OnReceiveInteralData type:{type} from {clientUserId}");
if (ignoreAllMessages)
{
Debug.LogError($"- IgnoreAllMessages :/");
return;
}
switch (type)
{
case InternalMessages.CONNECT:
Debug.LogError($"- CONNECT connectedId:{nextConnectionID + 1}");
if (epicToMirrorIds.Count >= maxConnections)
{
Debug.LogError("Reached max connections");
@ -97,6 +102,7 @@ public class Server : Common
case InternalMessages.DISCONNECT:
if (epicToMirrorIds.TryGetValue(clientUserId, out var connId))
{
Debug.LogError($"- DISCONNECT connectedId:{connId}");
OnDisconnected.Invoke(connId);
//CloseP2PSessionWithUser(clientUserId, socketId);
epicToMirrorIds.Remove(clientUserId);
@ -142,6 +148,7 @@ public class Server : Common
public void Disconnect(int connectionId)
{
Debug.LogError($"DISCONNECT {connectionId}");
if (epicToMirrorIds.TryGetValue(connectionId, out var userId))
{
SocketId socketId;
@ -152,7 +159,7 @@ public class Server : Common
}
else
{
Debug.LogWarning("Trying to disconnect unknown connection id: " + connectionId);
Debug.LogError("Trying to disconnect unknown connection id: " + connectionId);
}
}
@ -205,8 +212,11 @@ public class Server : Common
protected override void OnConnectionFailed(ProductUserId remoteId)
{
Debug.LogError($"OnConnectionFailed");
if (ignoreAllMessages)
{
Debug.LogError($"- IgnoreAllMessages :/");
return;
}

View File

@ -35,11 +35,15 @@ internal class PlayerKickMessage : QSBMessage<string>
return;
}
Delay.RunFramesLater(20, KickPlayer);
Delay.RunFramesLater(10, KickPlayer);
}
private void KickPlayer()
=> PlayerId.GetNetworkConnection().Disconnect();
{
var connectionToClient = PlayerId.GetNetworkConnection();
connectionToClient.Disconnect();
Transport.activeTransport.OnServerDisconnected(connectionToClient.connectionId);
}
public override void OnReceiveRemote()
{