private static void FreePacket(ChannelPacket packet) { NetworkDetailStats.SetStat(NetworkDetailStats.NetworkDirection.Outgoing, 0x1f, "msg", pendingPacketCount); if (s_FreePackets.Count < 0x200) { s_FreePackets.Add(packet); } }
public bool SendInternalBuffer() { bool result; if (this.m_IsReliable && this.m_PendingPackets.Count > 0) { while (this.m_PendingPackets.Count > 0) { ChannelPacket channelPacket = this.m_PendingPackets.Dequeue(); if (!channelPacket.SendToTransport(this.m_Connection, (int)this.m_ChannelId)) { this.m_PendingPackets.Enqueue(channelPacket); break; } ChannelBuffer.pendingPacketCount--; ChannelBuffer.FreePacket(channelPacket); if (this.m_IsBroken && this.m_PendingPackets.Count < this.m_MaxPendingPacketCount / 2) { if (LogFilter.logWarn) { Debug.LogWarning("ChannelBuffer recovered from overflow but data was lost."); } this.m_IsBroken = false; } } result = true; } else { result = this.m_CurrentPacket.SendToTransport(this.m_Connection, (int)this.m_ChannelId); } return(result); }