浏览代码

Minor fix - Users would be prevented from joining if the relay request arrived before the host knew that they had joined the lobby.

/main/staging/host_handshake
nathaniel.buck@unity3d.com 3 年前
当前提交
e9e2089b
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 2
      Assets/Scripts/Relay/RelayUtpClient.cs
  2. 2
      Assets/Scripts/Relay/RelayUtpHost.cs

2
Assets/Scripts/Relay/RelayUtpClient.cs


{
// Don't react to our own messages. Also, don't need to hold onto messages if the ID is absent; clients should be initialized and in the lobby before they send events.
// (Note that this enforces lobby membership before processing any events besides an approval request, so a client is unable to fully use Relay unless they're in the lobby.)
return id != m_localUser.ID && m_localLobby.LobbyUsers.ContainsKey(id) && (m_localUser.IsApproved || type == MsgType.PlayerApprovalState);
return id != m_localUser.ID && (m_localUser.IsApproved && m_localLobby.LobbyUsers.ContainsKey(id) || type == MsgType.PlayerApprovalState);
}
protected virtual void ProcessNetworkEventDataAdditional(NetworkConnection conn, MsgType msgType, string id) { }
protected virtual void ProcessDisconnectEvent(NetworkConnection conn, DataStreamReader strm)

2
Assets/Scripts/Relay/RelayUtpHost.cs


protected override bool CanProcessDataEventFor(NetworkConnection conn, MsgType type, string id)
{
// Don't send through data from one client to everyone else if they haven't been approved yet. (They should also not be sending data if not approved, so this is a backup.)
return base.CanProcessDataEventFor(conn, type, id) && (m_connections.Contains(conn) || type == MsgType.NewPlayer);
return id != m_localUser.ID && (m_localLobby.LobbyUsers.ContainsKey(id) && m_connections.Contains(conn) || type == MsgType.NewPlayer);
}
protected override void ProcessNetworkEventDataAdditional(NetworkConnection conn, MsgType msgType, string id)

正在加载...
取消
保存