Exemple #1
0
            /// <exception cref="System.IO.IOException"></exception>
            internal override OutputStream GetOutputStream()
            {
                // JSch won't let us interrupt writes when we use our InterruptTimer
                // to break out of a long-running write operation. To work around
                // that we spawn a background thread to shuttle data through a pipe,
                // as we can issue an interrupted write out of that. Its slower, so
                // we only use this route if there is a timeout.
                //
                OutputStream @out = this.channel.GetOutputStream();

                if (this._enclosing.GetTimeout() <= 0)
                {
                    return(@out);
                }
                PipedInputStream  pipeIn  = new PipedInputStream();
                StreamCopyThread  copier  = new StreamCopyThread(pipeIn, @out);
                PipedOutputStream pipeOut = new _PipedOutputStream_221(this, copier, pipeIn);

                // Just wake early, the thread will terminate anyway.
                copier.Start();
                return(pipeOut);
            }
Exemple #2
0
 /// <exception cref="System.IO.IOException"></exception>
 internal override OutputStream GetOutputStream()
 {
     // JSch won't let us interrupt writes when we use our InterruptTimer
     // to break out of a long-running write operation. To work around
     // that we spawn a background thread to shuttle data through a pipe,
     // as we can issue an interrupted write out of that. Its slower, so
     // we only use this route if there is a timeout.
     //
     OutputStream @out = this.channel.GetOutputStream();
     if (this._enclosing.GetTimeout() <= 0)
     {
         return @out;
     }
     PipedInputStream pipeIn = new PipedInputStream();
     StreamCopyThread copier = new StreamCopyThread(pipeIn, @out);
     PipedOutputStream pipeOut = new _PipedOutputStream_221(this, copier, pipeIn);
     // Just wake early, the thread will terminate anyway.
     copier.Start();
     return pipeOut;
 }