Ejemplo n.º 1
0
 public void setUp()
 {
     _stream = new PipeStream();
     _writer = new StreamWriter(_stream);
     //timer = new InterruptTimer();
     _timeoutstream = new TimeoutStream(_stream);
     _timeoutstream.setTimeout(timeout);
 }
Ejemplo n.º 2
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);
					i.setTimeout(_timeout * 1000);
                var o = new TimeoutStream(_rawOut );
					 o.setTimeout(_timeout * 1000);
                _rawIn = i;
                _rawOut = o;
            }

            _pckIn = new PacketLineIn(_rawIn);
            _pckOut = new PacketLineOut(_rawOut);
            Service();
        }
Ejemplo n.º 3
0
 public void testTimeout_readBuffer_Success2()
 {
     var s = new MemoryStream();
     var t = new TimeoutStream(s);
     t.setTimeout(timeout);
     byte[] exp = new byte[] { (byte)'a', (byte)'b', (byte)'c' };
     byte[] act = new byte[exp.Length];
     s.Write(exp, 0, exp.Length);
     s.Seek(0, SeekOrigin.Begin);
     IO.ReadFully(t, act, 0, 1);
     IO.ReadFully(t, act, 1, 1);
     IO.ReadFully(t, act, 2, 1);
     Assert.AreEqual(exp, act);
 }