Example #1
0
 public SideBandInputStream(PacketLineIn aPckIn, Stream aIns, ProgressMonitor aProgress)
 {
     pckIn = aPckIn;
     ins = aIns;
     monitor = aProgress;
     currentTask = "";
 }
 public SideBandInputStream(PacketLineIn aPckIn, Stream aIns, ProgressMonitor aProgress)
 {
     pckIn = aPckIn;
     ins = aIns;
     monitor = aProgress;
     currentTask = string.Empty;
     progressBuffer = string.Empty;
 }
        protected void init(Stream myStream)
        {
            stream = myStream is BufferedStream ? myStream : new BufferedStream(myStream, IndexPack.BUFFER_SIZE);

            pckIn = new PacketLineIn(stream);
            pckOut = new PacketLineOut(stream);
            outNeedsEnd = true;
        }
Example #4
0
        public void Execute(Stream inout)
        {
            Stream = inout;
            string cmd = new PacketLineIn(inout).ReadStringRaw();
            if (string.IsNullOrEmpty(cmd))
                return;

            int nul = cmd.IndexOf('\0');
            if (nul >= 0)
            {
                cmd = cmd.Slice(0, nul);
            }

            DaemonService srv = Daemon.MatchService(cmd);
            if (srv == null)
                return;
            srv.Execute(this, cmd);
        }
Example #5
0
 public void Upload(Stream stream, Stream messages)
 {
     this.stream = stream;
     pckIn = new PacketLineIn(stream);
     pckOut = new PacketLineOut(stream);
     service();
 }
Example #6
0
 private void init(string msg)
 {
     rawIn = new MemoryStream(Constants.encodeASCII(msg));
     pckIn = new PacketLineIn(rawIn);
 }
Example #7
0
        /// <summary>
        /// Execute the upload task on the socket.
        /// </summary>
        /// <param name="input">
        /// raw input to read client commands from. Caller must ensure the
        /// input is buffered, otherwise read performance may suffer.
        /// </param>
        /// <param name="output">
        /// response back to the Git network client, to write the pack
        /// data onto. Caller must ensure the output is buffered,
        /// otherwise write performance may suffer.
        /// </param>
        /// <param name="messages">
        /// secondary "notice" channel to send additional messages out
        /// through. When run over SSH this should be tied back to the
        /// standard error channel of the command execution. For most
        /// other network connections this should be null.
        /// </param>
        /// <exception cref="IOException"></exception>
        public void Upload(Stream input, Stream output, Stream messages)
        {
            _rawIn = input;
            _rawOut = output;

            if (_timeout > 0)
            {
                var i = new TimeoutStream(_rawIn, _timeout * 1000);
                var o = new TimeoutStream(_rawOut, _timeout * 1000);
                _rawIn = i;
                _rawOut = o;
            }

            _pckIn = new PacketLineIn(_rawIn);
            _pckOut = new PacketLineOut(_rawOut);
            Service();
        }
Example #8
0
        public void receive(Stream stream, Stream messages)
        {
            try
            {
                raw = stream;

                pckIn = new PacketLineIn(raw);
                pckOut = new PacketLineOut(raw);

                if (messages != null)
                {
                    msgs = new StreamWriter(messages);
                }

                enabledCapabilities = new List<string>();
                commands = new List<ReceiveCommand>();

                service();
            }
            finally
            {
                try
                {
                    if (msgs != null)
                        msgs.Flush();
                }
                finally
                {
                    unlockPack();
                    raw = null;
                    pckIn = null;
                    pckOut = null;
                    msgs = null;
                    refs = null;
                    enabledCapabilities = null;
                    commands = null;
                }
            }
        }