/// <exception cref="System.IO.IOException"></exception> private void SetupStreams() { this.inputStream = this.channel.GetInputStream(); // 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.timeout <= 0) { this.outputStream = @out; } else { PipedInputStream pipeIn = new PipedInputStream(); StreamCopyThread copier = new StreamCopyThread(pipeIn, @out); PipedOutputStream pipeOut = new _PipedOutputStream_173(this, copier, pipeIn); // Just wake early, the thread will terminate // anyway. copier.Start(); this.outputStream = pipeOut; } this.errStream = this.channel.GetErrStream(); }