onMassDisconnection and onServerRestart events

Post here your suggestions for new possible features in SmartFoxServer.

Moderators: Lapo, Bax

aMUSiC
Posts: 48
Joined: 15 Dec 2007, 17:15

onMassDisconnection and onServerRestart events

Postby aMUSiC » 23 Sep 2010, 13:14

One of the major problems arising from technical issues that either involve a mass disconnection of users (like a network issue that has to do with major backbone failures or the server's connectivity) or situation where a server restart while people are connected is needed, is that any extensions running on the server will terminate by performing their destroy() function.

This is of course an expected and graceful behavior, but on the case of games that a disconnection of a user defaults the game to the player remaining, things such as scores are being unfairly attributed to one of the players who happens to be later in the disconnection queue.

An idea I had would be to implement events such as an "onServerRestart" which would be invoked on all running scripts prior to the server being restarted. This would help the developers set flags and avoid unwanted and unfair execution of score keeping functions.

On the same note, another idea is an "onMassDisconnection" event, which would trigger if the server detects a mass disconnection of clients based on a configurable threshold would also be beneficial for the very same reasons as above.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 23 Sep 2010, 13:45

Hi,
thanks for the suggestions.
I am not sure if understand the (maybe subtle) difference between a destroy() event and a serverRestart() one.

When the destroy event is executed the message is... sorry this extension needs to be terminated, this is your last chance to execute any server side logic before we remove this extension instance.

When this happens you have the opportunity to store data in the DB, set any kind of flags where needed and take care of the "dirty" status of an interrupted game. Right?

So I am not sure where the serverRestart() event would provide additional help.

The "Mass Disconnection" idea is interesting, although tricky to implement. From the server perspective there's no way to understand what's going on in the network.
Sure, one could set a threshold of disconnections/sec. and use that as a warning signal that something bad is happening at the network level.

Supposing we do that and have an event firing if it's detected a disconnection rate > 100/sec what would be the developer supposed to do?
Also, each disconnection is also handled singularly by its USER_LOST event. It sounds like the two could "interfere" with each others.

In other words, supposing I have 1000 users playing games and all of a sudden I am notified that a burst of 100 users just left the server abruptly, I am not sure how this information could really help unless I have the details of all these users, which is what happens with the rapid fire of USER_LOST events

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Features Wish List”

Who is online

Users browsing this forum: No registered users and 14 guests