sfs.loadConfig().... SFSEvent.CONNECTION not dispatched?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Sparticus
Posts: 227
Joined: 27 Feb 2006, 17:44
Location: Canada
Contact:

sfs.loadConfig().... SFSEvent.CONNECTION not dispatched?

Postby Sparticus » 08 Feb 2012, 18:28

Hey all,

I made a game which uses SFS and everything runs just fine....

EXCEPT when I do the following :


1.) Shut down the SFS server (so it's not running)
2.) Run my game
3.) My game calls "sfs.loadConfig();"
4.) The client can see "SFSEvent.CONFIG_LOAD_SUCCESS" was fired
5.) After 15 seconds or so the game recents the event "SFSEvent.CONNECTION" where "evt.params.success" = false (so the connection failed.)

Above is what you'd expect, the server isn't running so it should clearly fail.

However, I added a feature to my game where if this happens, a popup window appears with a "Reconnect" button. Clicking the reconnect button will make another call to "sfs.loadConfig();" (which I am assuming will make another attempt to connect to the server.)

So, when I see the reconnect button, I start the SFS service. So, SFS is now running.

When I click on the reconnect button, I see the "SFSEvent.CONFIG_LOAD_SUCCESS" fire. I also see this in the server log :

Code: Select all

08 Feb 2012 11:18:26,062 INFO  [SocketReader] bitswarm.core.SocketAcceptor     - Session created: { Id: 1, Type: DEFAULT, Logged: No, IP: my_ap_address:40336 } on Server port: 9933 <---> 40336


So the game makes a connection to the server.... however, it ends there... no "SFSEvent.CONNECTION" event is fired.... nothing... it sits there indefinately....

After 15 seconds or so the server does this :

Code: Select all

08 Feb 2012 11:18:53,421 INFO  [Scheduler1-thread-1] bitswarm.sessions.DefaultSessionManager     - Session removed: { Id: 1, Type: DEFAULT, Logged: No, IP: my_ap_address:40336 }


So it removes the session. No events are fired to the client.

What am I missing?

Thanks!!
Jake-GR
Posts: 59
Joined: 28 Dec 2011, 22:52

Postby Jake-GR » 08 Feb 2012, 20:42

ive had a similar issue before (i think) it was because it tries "socket" for the connection type first, then switches to "http"... however if it fails there, it never switches back to "socket"

a quick patch that i did, was to disable using BlueBox on the client which causes it to stay in "socket" mode. if this is the case its been posted before... so hopefully it will be fixed in the next release.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 09 Feb 2012, 11:07

I'd suggest you to create a new SmartFox class instance before retrying the connection.
Paolo Bax
The SmartFoxServer Team
Sparticus
Posts: 227
Joined: 27 Feb 2006, 17:44
Location: Canada
Contact:

Postby Sparticus » 09 Feb 2012, 19:21

Ok, stupid question : Before creating a new smart fox instance... is this the correct way to "clean up" the old instance?

- Remove all listeners to the old instance
- then delete the instance

that's it/ I just don't want any memory leaks or other things still running that may slow down my game.

Thanks
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 09 Feb 2012, 22:16

Correct.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor and 39 guests