SFSEventType.USER_DISCONNECT can fired instant?

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

Moderators: Lapo, Bax

adifong
Posts: 20
Joined: 10 Aug 2016, 06:50

SFSEventType.USER_DISCONNECT can fired instant?

Postby adifong » 14 May 2018, 10:48

Hi,

i have a problem with sfs user disconnect event handler, can anyone help me..

why after user disconnect take so much time to fired handler event?
can i make it instant to fired disconnect handler event?

for information :
i make texas poker game, i use lisence 500 users sfs2x,
and when this happen, user connect to this zone 200++ users.
specs
------
os : windows server 2016 standard 64bit
proc : Intel® Xeon® Processor E5-2620 v2 15M Cache, 2.10 GHz
ram : 32


but i try this in testing server.. and only 1 user connect to this zone..
and the result is the event handler is call instant..

is there any solution?
thank you..


this is my log..

time : 09:55:27,100 -> user disconnect
[and i need to execute and use this user property..]
time : 09:55:27,698 -> call disconnect event handler.


14 May 2018 | 09:55:27,100 | INFO | qtp1801021153-4032 | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 118879, Type: WEBSOCKET, Logged: Yes, IP: }
14 May 2018 | 09:55:27,100 | INFO | SFSWorker:Sys:1 | v2.api.SFSApi | | User disconnected: { Zone: }, ( User Name: DANIEL19, Id: 112791, Priv: 0, Sess: ) , SessionLen: 513332, Type: Netscape:5.0 (Linux; U; Android 5.1.1; en-US; Lenovo A2020a40 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.5.0.1109 Mobile Safari/537.36

[here have code need to used user property disconnect..]

14 May 2018 | 09:55:27,698 | INFO | SFSWorker:Ext:1 | Extensions | | {txh_game}: DANIEL19 call logout handler event..




testing server..
14 May 2018 | 17:00:17,025 | INFO | qtp1202042637-83 | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 44, Type: WEBSOCKET, Logged: Yes, IP: }
14 May 2018 | 17:00:17,026 | INFO | SFSWorker:Sys:3 | v2.api.SFSApi | | User disconnected: { Zone: txh_game }, ( User Name: TESTX1, Id: 36, Priv: 0, Sess: ) , SessionLen: 4530, Type: Netscape:5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36
14 May 2018 | 17:00:17,026 | INFO | SFSWorker:Ext:4 | Extensions | | {txh_game}: TESTX1 call logout handler event..
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFSEventType.USER_DISCONNECT can fired instant?

Postby Lapo » 14 May 2018, 12:53

Hi,
are you sure that the message you log when the disconnection event handler is called is the first thing that is executed?
If not it is likely that what precedes the log call is taking some time to execute.

What does the handler do exactly?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
adifong
Posts: 20
Joined: 10 Aug 2016, 06:50

Re: SFSEventType.USER_DISCONNECT can fired instant?

Postby adifong » 15 May 2018, 00:56

Hi lapo,

this is my code, ok maybe the logic for subtring make the execution time more..

i will try to delete the substring code.. and put trace when the first load..

thank you.


Code: Select all

public class txhLogoutHandler extends BaseServerEventHandler {

   @Override
      public void handleServerEvent(ISFSEvent event) throws SFSException
      {
      
         
         List<Room> joinedRooms = (List<Room>) event.getParameter(SFSEventParam.JOINED_ROOMS);
         
         //Room room = (Room) event.getParameter(SFSEventParam.ROOM);
         User player = (User) event.getParameter(SFSEventParam.USER);
         Room room = player.getLastJoinedRoom();
         
         String user= player.getName().substring(0, (player.getName().length()-1));
              trace(user+" call logout handler event..");
        
         trace(player+" disconnect "+room);
         
         trace("ada "+joinedRooms.get(0));
         
         tFunc.exitRoom(player, joinedRooms.get(0));
         tFunc.exitGame(player);
         
          
      }
   
}

User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFSEventType.USER_DISCONNECT can fired instant?

Postby Lapo » 15 May 2018, 08:04

Hi,
no the substring call is not important. It will not add 500ms of execution time :)
I have no idea why that happens. It could be all kinds of things. Does this happen all the times? Or only sometimes?

Have you checked the state of the server when this happens? (cpu, threads, queues)

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
adifong
Posts: 20
Joined: 10 Aug 2016, 06:50

Re: SFSEventType.USER_DISCONNECT can fired instant?

Postby adifong » 22 May 2018, 02:15

hi,

not always like this, sometimes it work normal..
when that happen above that log have thread activity.. i think thread cause a bit slower.

but thanks anyway lapo..


22 May 2018 | 01:52:25,177 | INFO | qtp413373997-618 | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 9383, Type: WEBSOCKET, Logged: Yes, IP: :2161 }
22 May 2018 | 01:52:25,178 | INFO | SFSWorker:Ext:8 | Extensions | | {txh_game}: call logout handler..
22 May 2018 | 01:52:25,178 | INFO | SFSWorker:Sys:2 | v2.api.SFSApi | | User disconnected: { Zone: }, ( User Name: , Id: 8939, Priv: 0, Sess: :2161 ) , SessionLen: 54925, Type: Netscape:5.0 (Linux; Android 7.1.1; SM-J250F Build/NMF26X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.137 Mobile Safari/537.36

Return to “SFS2X Questions”

Who is online

Users browsing this forum: DavidoosNaw and 53 guests