internal bool SendRawAndRecycle(NetPacket packet, IPEndPoint remoteEndPoint) { var result = SendRaw(packet.RawData, 0, packet.Size, remoteEndPoint); NetPacketPool.Recycle(packet); return(result); }
internal bool ProcessConnectAccept(NetPacket packet) { if (_connectionState != ConnectionState.InProgress) { return(false); } //check connection id if (BitConverter.ToInt64(packet.RawData, NetConstants.AcceptConnectIdIndex) != _connectId) { NetUtils.DebugWrite(ConsoleColor.Cyan, "[NC] Invalid connectId: {0}", _connectId); return(false); } NetUtils.DebugWrite(ConsoleColor.Cyan, "[NC] Received connection accept"); _timeSinceLastPacket = 0; _connectionState = ConnectionState.Connected; _packetPool.Recycle(packet); return(true); }