void OnPacketReceived(ReceivedPacket packet) { if (steamIDToConnectionID.ContainsKey(packet.Sender)) { return; } var connectionID = steamIDToConnectionID.Count; connectionIDToSteamID.Add(packet.Sender); steamIDToConnectionID.Add(packet.Sender, connectionID); var connection = new Connection(callbackDistributor, packetDistributor, channels, packet.Sender); // FIXME: 初回必ず SYN を落としてしまう var establisher = new ConnectionEstablisherServer(connection); establisher.Connected += OnConnected; establisher.Disconnected += OnDisconnected; if (!connections.TryAdd(connectionID, connection)) { Debug.LogError("Already connected"); } if (!establishers.TryAdd(connectionID, establisher)) { Debug.LogError("Already connected"); } }
void OnPacketReceived(ReceivedPacket packet) { if (packet.Sender == Remote && packet.ChannelID == ChannelID) { receiveQueue.Enqueue(packet); } }