Exemple #1
0
        /// <exception cref="System.IO.IOException"></exception>
        private void NeedDataPacket()
        {
            if (eof || (channel == CH_DATA && available > 0))
            {
                return;
            }
            for (; ;)
            {
                available = pckIn.ReadLength();
                if (available == 0)
                {
                    eof = true;
                    return;
                }
                channel    = rawIn.Read() & unchecked ((int)(0xff));
                available -= SideBandOutputStream.HDR_SIZE;
                // length header plus channel indicator
                if (available == 0)
                {
                    continue;
                }
                switch (channel)
                {
                case CH_DATA:
                {
                    return;
                }

                case CH_PROGRESS:
                {
                    Progress(ReadString(available));
                    continue;
                    goto case CH_ERROR;
                }

                case CH_ERROR:
                {
                    eof = true;
                    throw new TransportException(PFX_REMOTE + ReadString(available));
                }

                default:
                {
                    throw new PackProtocolException(MessageFormat.Format(JGitText.Get().invalidChannel
                                                                         , channel));
                }
                }
            }
        }