1 2 29 30 package com.jcraft.jsch; 31 32 import java.util.*; 33 34 class ChannelSession extends Channel{ 35 private static byte[] _session="session".getBytes(); 36 37 protected boolean agent_forwarding=false; 38 protected boolean xforwading=false; 39 protected Hashtable env=null; 40 41 ChannelSession(){ 42 super(); 43 type=_session; 44 io=new IO(); 45 } 46 47 public void setAgentForwarding(boolean enable){ 48 agent_forwarding=enable; 49 } 50 public void setXForwarding(boolean enable){ 51 xforwading=enable; 52 } 53 public void setEnv(Hashtable env){ 54 this.env=env; 55 } 56 57 public void run(){ 58 63 64 Buffer buf=new Buffer(rmpsize); 66 Packet packet=new Packet(buf); 67 int i=-1; 68 try{ 69 while(isConnected() && 70 thread!=null && 71 io!=null && 72 io.in!=null){ 73 i=io.in.read(buf.buffer, 74 14, 75 buf.buffer.length-14 76 -32 -20 ); 78 79 if(i==0)continue; 80 if(i==-1){ 81 eof(); 82 break; 83 } 84 if(close)break; 85 packet.reset(); 87 buf.putByte((byte)Session.SSH_MSG_CHANNEL_DATA); 88 buf.putInt(recipient); 89 buf.putInt(i); 90 buf.skip(i); 91 session.write(packet, this, i); 92 } 93 } 94 catch(Exception e){ 95 } 98 if(thread!=null){ 99 synchronized(thread){ thread.notifyAll(); } 100 } 101 thread=null; 102 } 104 } 105 | Popular Tags |