Can't remove user

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

Moderators: Lapo, Bax

Post Reply
User avatar
mete2221
Posts: 82
Joined: 30 Aug 2017, 17:01

Can't remove user

Post by mete2221 »

disconnectUser causes Can't remove user

Basically, the code disconnects of different characters belonging to the user on login.

This exception happens sometimes, not always.

Code: Select all

com.smartfoxserver.v2.exceptions.SFSRuntimeException: Can't remove user: ( User Name: [Filtered], Id: 40930, Priv: 1, Sess: [Filtered] ) , from: [ Room: [Filtered], Id: 1491, Group: [Filtered], isGame: false ]
    at com.smartfoxserver.v2.entities.managers.SFSRoomManager.removeUser(SFSRoomManager.java:520)
    at com.smartfoxserver.v2.entities.managers.SFSRoomManager.removeUser(SFSRoomManager.java:505)
    at com.smartfoxserver.v2.entities.SFSZone.removeUser(SFSZone.java:1292)
    at com.smartfoxserver.v2.api.SFSApi.disconnectUser(SFSApi.java:323)
    at com.custom.service.SFSUserService.disconnect(SFSUserService.java:289)
    at com.custom.handler.LoginEventHandler.handle(LoginEventHandler.java:244)
    at com.custom.handler.EventHandler.handleServerEvent(EventHandler.java:32)
    at com.smartfoxserver.v2.extensions.SFSExtension.handleServerEvent(SFSExtension.java:282)
    at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.dispatchEvent(SFSExtensionManager.java:773)
    at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.dispatchZoneLevelEvent(SFSExtensionManager.java:694)
    at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.handleServerEvent(SFSExtensionManager.java:898)
    at com.smartfoxserver.v2.core.SFSEventManager$SFSEventRunner.run(SFSEventManager.java:66)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.lang.Thread.run(Thread.java:829)


Code:

Code: Select all

public void disconnect(User user, IDisconnectionReason reason) throws SanalikaException
{
    if (user == null || !user.isConnected())
      return;

    user.disconnect(reason);
    API.disconnectUser(user);
}
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Can't remove user

Post by Lapo »

Well, you're disconnecting the client twice. I'd expect some complainin' :D
Remove one of the two lines and you'll be fine, they accomplish exactly the same thing.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
mete2221
Posts: 82
Joined: 30 Aug 2017, 17:01

Re: Can't remove user

Post by mete2221 »

Lapo wrote:Well, you're disconnecting the client twice. I'd expect some complainin' :D
Remove one of the two lines and you'll be fine, they accomplish exactly the same thing.

Cheers


Changes made on the user are usually not synchronized, I wanted to bring the user object to the disconnect state and secure my work, thanks.
Post Reply