Possible bug in AS2 client

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
endquote
Posts: 35
Joined: 29 Dec 2006, 00:39
Location: Seattle, WA
Contact:

Possible bug in AS2 client

Post 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()
}
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post 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,
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Additionally connectionClosed() should not be called when the disconnection comes from the client. That method handles an unexpected socket disconnection
Lapo
--
gotoAndPlay()
...addicted to flash games
endquote
Posts: 35
Joined: 29 Dec 2006, 00:39
Location: Seattle, WA
Contact:

Post 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!
Post Reply