[Spread-users] Connection closed while reading authname

Ryan Caudy rcaudy at gmail.com
Sat Nov 6 12:08:07 EST 2004

HI Alberto,

I think I see the problem here.  What is likely happening is that the
server hasn't noticed that your first client with that private name
disconnected yet, because of the abrupt way that you had to terminate
it.  So, it rejects the connection with -6, REJECT_NOT_UNIQUE.  To
confirm this, try to replicate this problem with the server logging
SESSION information, and see if there is a corresponding output.

I think that you are not seeing the correct SpreadException because of
what I think is a slight bug in the Java Spread library.  It read one
byte to get the length of the authorization methods information...
this byte doubles as a response to the initial connection messages
passed by the client.  It's read with this command:
     len = socketInput.read();
Then, it's evaluated with this command (if it's not -1):
    if( len < -1 )
        throw new SpreadException("Connection attempt rejected=" + (byte)len);

The Java API Documentation for InputStream.read() reads as follows:
    Reads the next byte of data from the input stream. The value byte
is returned as an int
    in the range 0 to 255. If no byte is available because the end of
the stream has been
    reached, the value -1 is returned.

I don't think Java even has the notion of a signed byte.  So, we need
to do a computation to identify the correct returned value, probably
something like this:
    if( len >= 128 )
        throw new SpreadException("Connection attempt rejected=" +
(0xffffff00 | len) );

I'll see what Jonathan thinks, and see about getting this bugfix into
CVS sometime soon.


On Thu, 4 Nov 2004 20:42:12 +0100 (CET), Alberto Martinez
<albertinho_2000 at yahoo.es> wrote:
> Hi!
>    Once solved the problem with messages, I connect a
> server with "Server 1" private name. Due to problems
> I've to exit the server execution by pressing
> CONTROL+C in command console. However when I try to
> reconnect using the same private name, I get this
> result:
> Scheduler: line 96:spread.SpreadException: Connection
> closed while reading authname
>    How can I solve this?? Thanks!
> ______________________________________________
> Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
> Nuevos servicios, más seguridad
> http://correo.yahoo.es
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users

Ryan W. Caudy
<rcaudy at gmail.com>
Bloomberg L.P.
<rcaudy1 at bloomberg.net>
<caudy at cnds.jhu.edu>         
Center for Networking and Distributed Systems
Department of Computer Science
Johns Hopkins University          

More information about the Spread-users mailing list