public override void Disconnect() { if (m_Dispose) { return; } m_Transport.Disconnect(true, false); }
public void RecvReliablePackets(ClientTransport transport, KcpCon kcp, List <Packet> packets, ClientHeartbeatProcessing heartbeat) { while (true) { int size = kcp.Recv(m_Buffer, 0, m_Buffer.Length); if (size <= 0) { break; } if (size == 8) { ByteReadMemory memory = new ByteReadMemory(m_Buffer, 0, 8); uint flag = memory.ReadUInt(); uint conv = memory.ReadUInt(); if (conv == kcp.Conv) { if (flag == KcpConstants.Flag_Heartbeat) { heartbeat.RecvHeartbeat(); continue; } if (flag == KcpConstants.Flag_Disconnect) { transport.Disconnect(false, true); continue; } } } PacketProcessing.Recv(m_Buffer, 0, size, packets); } }