Page 1 of 1

Possible bug in AS2 client

Posted: 09 Jul 2007, 02:21
by endquote
I'm finding in my Smartfox app that if I call SmartfoxClient.disconnect and then call SmartfoxClient.connect again later, I get an error in the console saying "WARNING! You are already connected to ...ip address..." when in fact the connection has been closed. The source of the disconnect method is:

Code: Select all

public function disconnect()
{
	close()
	onConnectionLost()
}
With this code, the connectionClosed method never gets called, which is what sets this.connected to false and allows a second connection.

Seems to me that the disconnect method should be:

Code: Select all

public function disconnect()
{
	close()
	connectionClosed()
}

Posted: 09 Jul 2007, 08:50
by Lapo
Which version of the API do you use?
Those coming with SFS 1.5.5 (they are v 1.4.0) have this method:

Code: Select all

       public function disconnect()
	{
		close()
		isConnected = false
		
		onConnectionLost()
	}

cheers,

Posted: 09 Jul 2007, 08:51
by Lapo
Additionally connectionClosed() should not be called when the disconnection comes from the client. That method handles an unexpected socket disconnection

Posted: 09 Jul 2007, 18:07
by endquote
I was using an older version of the AS2 classes. I've been updating the server when updates come out, but not the API code.

Thanks!