UnityEngine.Networking.ChannelBuffer.SendBytes C# (CSharp) Method

SendBytes() private method

private SendBytes ( byte bytes, int bytesToSend ) : bool
bytes byte
bytesToSend int
return bool
        internal bool SendBytes(byte[] bytes, int bytesToSend)
        {
            NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, 0x1c, "msg", 1);
            if (bytesToSend > this.m_MaxPacketSize)
            {
                byte num;
                if (LogFilter.logDebug)
                {
                    Debug.Log(string.Concat(new object[] { "SendBytes large packet: ", bytesToSend, "channel ", this.m_ChannelId }));
                }
                if (this.m_Connection.TransportSend(bytes, bytesToSend, this.m_ChannelId, out num))
                {
                    return true;
                }
                if (LogFilter.logError)
                {
                    Debug.LogError("Failed to send big message");
                }
                return false;
            }
            if (!this.m_CurrentPacket.HasSpace(bytesToSend))
            {
                if (this.m_IsReliable)
                {
                    if (this.m_PendingPackets.Count == 0)
                    {
                        if (!this.m_CurrentPacket.SendToTransport(this.m_Connection, this.m_ChannelId))
                        {
                            this.QueuePacket();
                        }
                        this.m_CurrentPacket.Write(bytes, bytesToSend);
                        return true;
                    }
                    if (this.m_PendingPackets.Count >= this.m_MaxPendingPacketCount)
                    {
                        if (!this.m_IsBroken && LogFilter.logError)
                        {
                            Debug.LogError("ChannelBuffer buffer limit of " + this.m_PendingPackets.Count + " packets reached.");
                        }
                        this.m_IsBroken = true;
                        return false;
                    }
                    this.QueuePacket();
                    this.m_CurrentPacket.Write(bytes, bytesToSend);
                    return true;
                }
                if (!this.m_CurrentPacket.SendToTransport(this.m_Connection, this.m_ChannelId))
                {
                    if (LogFilter.logError)
                    {
                        Debug.Log("ChannelBuffer SendBytes no space on unreliable channel " + this.m_ChannelId);
                    }
                    return false;
                }
                this.m_CurrentPacket.Write(bytes, bytesToSend);
                return true;
            }
            this.m_CurrentPacket.Write(bytes, bytesToSend);
            if (this.maxDelay == 0f)
            {
                return this.SendInternalBuffer();
            }
            return true;
        }