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); }
public bool SendInternalBuffer() { NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short)29, "msg", 1); if (!this.m_IsReliable || this.m_PendingPackets.Count <= 0) { return(this.m_CurrentPacket.SendToTransport(this.m_Connection, (int)this.m_ChannelId)); } while (this.m_PendingPackets.Count > 0) { ChannelPacket packet = this.m_PendingPackets.Dequeue(); if (!packet.SendToTransport(this.m_Connection, (int)this.m_ChannelId)) { this.m_PendingPackets.Enqueue(packet); break; } --ChannelBuffer.pendingPacketCount; ChannelBuffer.FreePacket(packet); if (this.m_IsBroken && this.m_PendingPackets.Count < this.m_MaxPendingPacketCount / 2) { if (LogFilter.logWarn) { Debug.LogWarning((object)"ChannelBuffer recovered from overflow but data was lost."); } this.m_IsBroken = false; } } return(true); }
public bool SendInternalBuffer() { if (this.m_IsReliable && this.m_PendingPackets.Count > 0) { while (this.m_PendingPackets.Count > 0) { ChannelPacket packet = this.m_PendingPackets[0]; if (!packet.SendToTransport(this.m_Connection, (int)this.m_ChannelId)) { break; } ChannelBuffer.pendingPacketCount--; this.m_PendingPackets.RemoveAt(0); ChannelBuffer.FreePacket(packet); 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; } } return(true); } return(this.m_CurrentPacket.SendToTransport(this.m_Connection, (int)this.m_ChannelId)); }