Skip to content

Commit

Permalink
jsch-0.1.40
Browse files Browse the repository at this point in the history
  • Loading branch information
Atsuhiko Yamanaka authored and joshbeitelspacher committed Feb 13, 2011
1 parent 5303493 commit 248e856
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 29 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Expand Up @@ -2,6 +2,11 @@ ChangeLog of JSch
====================================================================
Last modified: Fri Jun 13 02:12:52 UTC 2008

Changes since version 0.1.39:
- bugfix: ProxySOCKS4 had not been functional. FIXED.
- bugfix: NPE at closing the session when it is not opened. FIXED.
- change: JSch#getConfing has become public.


Changes since version 0.1.38:
- bugfix: session will be dropped at rekeying. FIXED.
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -5,7 +5,7 @@ sshd server and use port forwarding, X11 forwarding, file transfer, etc., and
you can integrate its functionality into your own Java programs
</description>
<!-- set global properties for this build -->
<property name="version" location="0.1.36"/>
<property name="version" location="0.1.40"/>
<property name="src" location="src"/>
<property name="exasrc" location="examples"/>
<property name="build" location="build"/>
Expand Down
6 changes: 4 additions & 2 deletions src/com/jcraft/jsch/JSch.java
Expand Up @@ -263,8 +263,10 @@ public void removeAllIdentity() throws JSchException{
}
}

String getConfig(String key){
return (String)(config.get(key));
public static String getConfig(String key){
synchronized(config){
return (String)(config.get(key));
}
}

public static void setConfig(java.util.Hashtable newconf){
Expand Down
2 changes: 1 addition & 1 deletion src/com/jcraft/jsch/ProxySOCKS4.java
Expand Up @@ -161,7 +161,7 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim
The remaining fields are ignored.
*/

int len=6;
int len=8;
int s=0;
while(s<len){
int i=in.read(buf, s, len-s);
Expand Down
69 changes: 44 additions & 25 deletions src/com/jcraft/jsch/Session.java
Expand Up @@ -105,6 +105,7 @@ public class Session implements Runnable{
private boolean isAuthed=false;

private Thread connectThread=null;
private Object lock=new Object();

boolean x11_forwarding=false;
boolean agent_forwarding=false;
Expand Down Expand Up @@ -456,12 +457,21 @@ public void connect(int connectTimeout) throws JSchException{
}

isAuthed=true;
connectThread=new Thread(this);
connectThread.setName("Connect thread "+host+" session");
if(daemon_thread){
connectThread.setDaemon(daemon_thread);

synchronized(lock){
if(isConnected){
connectThread=new Thread(this);
connectThread.setName("Connect thread "+host+" session");
if(daemon_thread){
connectThread.setDaemon(daemon_thread);
}
connectThread.start();
}
else{
// The session has been already down and
// we don't have to start new thread.
}
}
connectThread.start();
}
catch(Exception e) {
in_kex=false;
Expand Down Expand Up @@ -1135,12 +1145,15 @@ public void write(Packet packet) throws Exception{
}
_write(packet);
}
private synchronized void _write(Packet packet) throws Exception{
encode(packet);
if(io!=null){
io.put(packet);
seqo++;
}

private void _write(Packet packet) throws Exception{
synchronized(lock){
encode(packet);
if(io!=null){
io.put(packet);
seqo++;
}
}
}

Runnable thread;
Expand Down Expand Up @@ -1487,10 +1500,12 @@ public void disconnect(){
PortWatcher.delPort(this);
ChannelForwardedTCPIP.delPort(this);

synchronized(connectThread){
Thread.yield();
connectThread.interrupt();
connectThread=null;
synchronized(lock){
if(connectThread!=null){
Thread.yield();
connectThread.interrupt();
connectThread=null;
}
}
thread=null;
try{
Expand Down Expand Up @@ -1717,20 +1732,24 @@ public void setConfig(java.util.Properties newconf){
setConfig((java.util.Hashtable)newconf);
}

public synchronized void setConfig(java.util.Hashtable newconf){
if(config==null)
config=new java.util.Hashtable();
for(java.util.Enumeration e=newconf.keys() ; e.hasMoreElements() ;) {
String key=(String)(e.nextElement());
config.put(key, (String)(newconf.get(key)));
public void setConfig(java.util.Hashtable newconf){
synchronized(lock){
if(config==null)
config=new java.util.Hashtable();
for(java.util.Enumeration e=newconf.keys() ; e.hasMoreElements() ;) {
String key=(String)(e.nextElement());
config.put(key, (String)(newconf.get(key)));
}
}
}

public synchronized void setConfig(String key, String value){
if(config==null){
config=new java.util.Hashtable();
public void setConfig(String key, String value){
synchronized(lock){
if(config==null){
config=new java.util.Hashtable();
}
config.put(key, value);
}
config.put(key, value);
}

public String getConfig(String key){
Expand Down

0 comments on commit 248e856

Please sign in to comment.