Page 1 of 1

logout is broken in Latest Flas client API?

Posted: 23 Feb 2012, 04:26
by levancho
I am performing logout following way

Code: Select all

	var lr:LogoutRequest  =new LogoutRequest();
			this._smartFox.send(lr);
and I am gettig following error:

Code: Select all

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at com.smartfoxserver.v2::SmartFox/handleLogout()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/SmartFox.as:1912]
	at com.smartfoxserver.v2.controllers::SystemController/fnLogout()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/controllers/SystemController.as:827]
	at com.smartfoxserver.v2.controllers::SystemController/handleMessage()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/controllers/SystemController.as:127]
	at com.smartfoxserver.v2.core::SFSProtocolCodec/dispatchRequest()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/core/SFSProtocolCodec.as:150]
	at com.smartfoxserver.v2.core::SFSProtocolCodec/onPacketRead()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/core/SFSProtocolCodec.as:54]
	at com.smartfoxserver.v2.core::SFSIOHandler/handlePacketData()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/core/SFSIOHandler.as:246]
	at com.smartfoxserver.v2.core::SFSIOHandler/onDataRead()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/core/SFSIOHandler.as:105]
	at com.smartfoxserver.v2.bitswarm::BitSwarmClient/onSocketData()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/bitswarm/BitSwarmClient.as:419]
and in server logs as soon as I click logout I see following:

Code: Select all

23:21:59,627 INFO  [com.smartfoxserver.v2.controllers.SystemController-1] entities.SFSZone     - User: givi was disconne
cted.
 INFO 2012-02-22 23:21:59,627 com.smartfoxserver.v2.entities.SFSZone: User: givi was disconnected.
23:21:59,631 INFO  [com.smartfoxserver.v2.controllers.SystemController-1] api.SFSApi     - User logout: ( User Name: giv
i, Id: 0, Priv: 0, Sess: 127.0.0.1:57744 )
 INFO 2012-02-22 23:21:59,631 com.smartfoxserver.v2.api.SFSApi: User logout: ( User Name: givi, Id: 0, Priv: 0, Sess: 12
7.0.0.1:57744 )
in addition after I release debugger to continue execution I see additiona info in the trace log:

Code: Select all

Ouch, connection was lost. Reason: unknown
[SFS - WARN] You are not connected. Request cannot be sent: [object LogoutRequest]
1
Sec view is open 
.. 
I have latest version of Smartfox client and servers, I upgraded everything the day before yesterday.
I am ussing 64 bit on windows 7 platform.

Re: logout is broken in Latest Flas client API?

Posted: 23 Feb 2012, 04:48
by levancho
UPDATE:

I am also getting exeptions in server log as soon as I terminate the UI debugger and as soon as my AIR client terminates: here is the error:

Code: Select all

23:46:48,122 WARN  [SocketReader] core.SocketReader     -
com.smartfoxserver.v2.exceptions.SFSRuntimeException: -Unexpected- Cannot find any User for Session: { Id: 10, Type: DEF
AULT, Logged: No, IP: 127.0.0.1:57873 }
        com.smartfoxserver.v2.SmartFoxServer.onSessionReconnectionTry(SmartFoxServer.java:921)
        com.smartfoxserver.v2.SmartFoxServer.access$3(SmartFoxServer.java:916)
        com.smartfoxserver.v2.SmartFoxServer$BitSwarmEventListener.handleEvent(SmartFoxServer.java:977)
        com.smartfoxserver.bitswarm.service.BaseCoreService.dispatchEvent(BaseCoreService.java:110)
        com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.dispatchSessionReconnectionTryEvent(DefaultSessionMan
ager.java:778)
        com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.onSocketDisconnected(DefaultSessionManager.java:349)
        com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.onSocketDisconnected(DefaultSessionManager.java:335)
        com.smartfoxserver.bitswarm.core.SocketReader.closeTcpConnection(SocketReader.java:349)
        com.smartfoxserver.bitswarm.core.SocketReader.readTcpData(SocketReader.java:318)
        com.smartfoxserver.bitswarm.core.SocketReader.readIncomingSocketData(SocketReader.java:228)
        com.smartfoxserver.bitswarm.core.SocketReader.run(SocketReader.java:172)
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)

 WARN 2012-02-22 23:46:48,122 com.smartfoxserver.bitswarm.util.Logging:
com.smartfoxserver.v2.exceptions.SFSRuntimeException: -Unexpected- Cannot find any User for Session: { Id: 10, Type: DEF
AULT, Logged: No, IP: 127.0.0.1:57873 }
        com.smartfoxserver.v2.SmartFoxServer.onSessionReconnectionTry(SmartFoxServer.java:921)
        com.smartfoxserver.v2.SmartFoxServer.access$3(SmartFoxServer.java:916)
        com.smartfoxserver.v2.SmartFoxServer$BitSwarmEventListener.handleEvent(SmartFoxServer.java:977)
        com.smartfoxserver.bitswarm.service.BaseCoreService.dispatchEvent(BaseCoreService.java:110)
        com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.dispatchSessionReconnectionTryEvent(DefaultSessionMan
ager.java:778)
        com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.onSocketDisconnected(DefaultSessionManager.java:349)
        com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.onSocketDisconnected(DefaultSessionManager.java:335)
        com.smartfoxserver.bitswarm.core.SocketReader.closeTcpConnection(SocketReader.java:349)
        com.smartfoxserver.bitswarm.core.SocketReader.readTcpData(SocketReader.java:318)
        com.smartfoxserver.bitswarm.core.SocketReader.readIncomingSocketData(SocketReader.java:228)
        com.smartfoxserver.bitswarm.core.SocketReader.run(SocketReader.java:172)
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)

Re: logout is broken in Latest Flas client API?

Posted: 23 Feb 2012, 09:27
by Lapo
Yes, there seem to be an issue with the lagMonitor being destroyed at logout.
We'll publish an update very soon. Thanks for reporting

Re: logout is broken in Latest Flas client API?

Posted: 23 Feb 2012, 09:33
by Lapo
You cab work around the issue temporarily by enabling the lagMonitor upon login.
In other words in your login handler you can call this:

Code: Select all

sfs.enableLagMonitor(true)
This way you will activate the lag monitor tool which measures the lag between client and server by sending a small request every 4 seconds. If you don't want all this messaging to happen, you can slow down the tool like this:

Code: Select all

enableLagMonitor(true,120,10)
The middle argument specifies the amount of seconds between each measurement. (You can be extreme with it and push it to one every hour...with a value of 3600)

Re: logout is broken in Latest Flas client API?

Posted: 23 Feb 2012, 10:17
by Bax
A minor update to the AS3 API has been published, fixing the reported issue.
Check the Updates section of the SFS2X download page.

[RESOLVED]Re: logout is broken in Latest Flas client API?

Posted: 23 Feb 2012, 11:52
by levancho
thanks guys for such a quick response.
I have downloaded the updated API and I confirm that it works now.