Skip to content
This repository has been archived by the owner on Sep 5, 2022. It is now read-only.

Commit

Permalink
Flip define and add some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxpxr committed Jul 8, 2021
1 parent 37f3179 commit 68ad9ef
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ public bool Start(ushort port = 7070)

return true;
}
catch
catch (Exception e)
{
Logger.ForceLogMessage(e.ToString(), ConsoleColor.Red);
return false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions UnityProject/Assets/LRMTestScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
clientToServerTransport: {fileID: 1521806211}
serverIP: localhost
serverIP: 68.174.160.78
serverPort: 7777
endpointServerPort: 8080
heartBeatInterval: 3
Expand All @@ -1254,7 +1254,7 @@ MonoBehaviour:
loadBalancerAddress: 127.0.0.1
serverName: My awesome server!
extraServerData: Map 1
maxServerPlayers: 10
maxServerPlayers: 2
isPublicServer: 1
serverListUpdated:
m_PersistentCalls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,36 +151,40 @@ public override void ClientSend(int channelId, ArraySegment<byte> segment)
}
}

#if MIRROR_37_0_OR_NEWER
public override void ServerDisconnect(int connectionId)
#if !MIRROR_37_0_OR_NEWER

public override bool ServerDisconnect(int connectionId)
{
if (_connectedRelayClients.TryGetBySecond(connectionId, out int relayId))
{
int pos = 0;
_clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.KickPlayer);
_clientSendBuffer.WriteInt(ref pos, relayId);
return;
return true;
}

if (_connectedDirectClients.TryGetBySecond(connectionId, out int directId))
_directConnectModule.KickClient(directId);
return _directConnectModule.KickClient(directId);

return false;
}

#else
public override bool ServerDisconnect(int connectionId)

public override void ServerDisconnect(int connectionId)
{
if (_connectedRelayClients.TryGetBySecond(connectionId, out int relayId))
{
int pos = 0;
_clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.KickPlayer);
_clientSendBuffer.WriteInt(ref pos, relayId);
return true;
return;
}

if (_connectedDirectClients.TryGetBySecond(connectionId, out int directId))
return _directConnectModule.KickClient(directId);

return false;
_directConnectModule.KickClient(directId);
}

#endif

#if MIRROR_40_0_OR_NEWER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ IEnumerator RetrieveMasterServerListFromLoadBalancer(LRMRegions region)

case UnityWebRequest.Result.Success:
relayServerList?.Clear();
relayServerList = JsonUtilityHelper.FromJson<Room>(result.Decompress()).ToList();
relayServerList = JsonUtilityHelper.FromJson<Room>(result).ToList();
serverListUpdated?.Invoke();
_serverListUpdated = true;
break;
Expand All @@ -217,7 +217,7 @@ IEnumerator RetrieveMasterServerListFromLoadBalancer(LRMRegions region)
else
{
relayServerList?.Clear();
relayServerList = JsonUtilityHelper.FromJson<Room>(result.Decompress()).ToList();
relayServerList = JsonUtilityHelper.FromJson<Room>(result).ToList();
serverListUpdated?.Invoke();
_serverListUpdated = true;
}
Expand Down

0 comments on commit 68ad9ef

Please sign in to comment.