Server fails to remove user when ethernet unplugged

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

Moderators: Lapo, Bax

intomo
Posts: 51
Joined: 22 Nov 2010, 21:21
Location: Los Angeles

Server fails to remove user when ethernet unplugged

Postby intomo » 07 Dec 2021, 17:48

I have a weird bug. I have apps on iPhones connecting. The get all the normal events fired. The userlist works fine and updates when I quit the app on any phone. All working as expected. However, these phones are connected via ethernet dongles. If I pull the plug on any dongle, the app immediately triggers onConnectionLost and I see that in the app. But the server never removes that user. And if I try to log in again on that app, the server refuses that connection because of a duplicate user name. Any input on this? Is there a setting in the server config to lower the amount of time the server hangs on to users? I see no errors on the server other than duplicate username refused. Server is on MacOSX, current build 2.17.3 with objective-c api 1.7.12. Thanks in advance.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server fails to remove user when ethernet unplugged

Postby Lapo » 08 Dec 2021, 10:10

Hi,
pulling the plugs doesn't allow the disconnection to complete. Because a TCP disconnection requires an exchange of messages between client and server, pulling the plug physically prevents it.

For more details we have an in depth article on this topic, here:
https://smartfoxserver.com/blog/what-re ... tworkwifi/

Also this might interest you:
https://smartfoxserver.com/blog/handlin ... e-devices/

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
intomo
Posts: 51
Joined: 22 Nov 2010, 21:21
Location: Los Angeles

Re: Server fails to remove user when ethernet unplugged

Postby intomo » 13 Dec 2021, 19:52

Is it possible to write an extension such:
User would log in through the extension
Extension would check for duplicate username in the userlist
If the duplicate existed, it would disconnect that user
It would then log in current user

Thanks for all your help
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server fails to remove user when ethernet unplugged

Postby Lapo » 14 Dec 2021, 15:57

Hi,
this mechanism already exists. The server does exactly the same thing if your turn on the forceLogout option in your Zone.

However this will not work very reliably with the use case you have described (pulling the ethernet cable), because of the reason I already explained. If you physically remove the cable the disconnection will not be acknowledged by the server because they parties cannot send messages to each other.

Therefore the only way out is to wait TCP timeout that will trigger on the server side, evenutally.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 20 guests