Index: SpreadConnection.java =================================================================== RCS file: /storage/cvsroot/spread/javalib/SpreadConnection.java,v retrieving revision 1.9 diff -u -r1.9 SpreadConnection.java --- SpreadConnection.java 6 Oct 2004 14:08:18 -0000 1.9 +++ SpreadConnection.java 6 Nov 2004 22:41:24 -0000 @@ -474,9 +474,9 @@ } // Check if it was a response code ////////////////////////////////// - if( len < -1 ) + if( len >= 128 ) { - throw new SpreadException("Connection attempt rejected=" + (byte)len); + throw new SpreadException("Connection attempt rejected=" + (0xffffff00 | len)); } // Read the name. @@ -585,7 +585,7 @@ /////////////////// if(accepted != ACCEPT_SESSION) { - throw new SpreadException("Connection attempt rejected=" + (byte)accepted); + throw new SpreadException("Connection attempt rejected=" + (0xffffff00 | accepted)); } } @@ -1477,6 +1477,10 @@ ////////////////// listener.signal = true; + // Wait for the thread to die, to avoid inconsistencies. + //////////////////////////////////////////////////////// + listener.join(); + // Clear the variable. ////////////////////// listener = null;