source: other-projects/trunk/gs3-release-maker/tasks/sshtaskdef/src/mindbright/ssh/SSHTxChannel.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 2.0 KB
Line 
1/******************************************************************************
2 *
3 * Copyright (c) 1998,99 by Mindbright Technology AB, Stockholm, Sweden.
4 * www.mindbright.se, [email protected]
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 *****************************************************************************
17 * $Author: mats $
18 * $Date: 2000/03/02 19:52:24 $
19 * $Name: rel1-2-1 $
20 *****************************************************************************/
21package mindbright.ssh;
22
23import java.io.*;
24
25public class SSHTxChannel extends SSHChannel {
26
27 protected OutputStream out;
28 protected SSHPduQueue queue;
29
30 boolean closePending;
31
32 public SSHTxChannel(OutputStream out, int channelId) {
33 super(channelId);
34 this.out = out;
35 this.closePending = false;
36 queue = new SSHPduQueue();
37 }
38
39 public SSHPduQueue getQueue() {
40 return queue;
41 }
42
43 public void setClosePending() {
44 closePending = true;
45 queue.release();
46 }
47
48 public synchronized boolean isClosePending() {
49 return closePending;
50 }
51
52 public void serviceLoop() throws Exception {
53 SSH.logExtra("Starting tx-chan: " + channelId);
54 for(;;) {
55 SSHPdu pdu;
56 // !!! the thread is (hopefully) suspended when we set closePending
57 // so we don't have to access a lock each loop
58 if(closePending && queue.isEmpty()) {
59 throw new Exception("CLOSE");
60 }
61 pdu = queue.getFirst();
62 // pdu = pdu.preProcess();
63 pdu.writeTo(out);
64 // pdu = pdu.postProcess();
65 }
66 }
67
68}
Note: See TracBrowser for help on using the repository browser.