void HandleConnectionlessInboundPacket(NetConnectionlessInboundPacket packet) { if (packet.Type == NetPacketType.ConnectionRequest) { NetConnectionRequest request = new NetConnectionRequest(packet); HandleConnectionRequest(request); } else if (packet.Type == NetPacketType.ConnectionApproved) { HandleConnectionApproved(packet.SenderIP); } else if (packet.Type == NetPacketType.ConnectionDenied) { NetDenialReason reason = (NetDenialReason)packet.ReadByte(); HandleConnectionDenied(packet.SenderIP, reason); } else if (packet.Type == NetPacketType.ConnectionReady) { HandleConnectionReady(packet.SenderIP); } else { AddWatchedConnection(packet.SenderIP, string.Format("Sent invalid connectionless packet ({0})", packet.Type)); } }
protected override void HandleConnectionDenied(IPEndPoint from, NetDenialReason reason) { if (awaitingConnectionResponse) { lastConnectionApproved = false; lastDenialReason = reason; awaitingConnectionResponse = false; } else { AddWatchedConnection(from, "ConnectionDenied received, but this client is not connecting!"); } base.HandleConnectionDenied(from, reason); }
protected virtual void HandleConnectionDenied(IPEndPoint from, NetDenialReason reason) { }