number of total users is not correct when userLost

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

jiaxintang
Posts: 7
Joined: 29 Nov 2008, 16:48

number of total users is not correct when userLost

Postby jiaxintang » 15 Dec 2008, 05:43

I've found something really strange. Here are the steps my program do:
1. User login into the zone and join the default room(room1)
2. The zone extension create a new room(room2) and join this user into the new room
3. User do not leave the old room, so he is in two rooms(room1 and room2)
4. User closed the client flash program so zone extension and room extension both get 'userLost' , and the user is disappeared from the old room(room1) and the new created room(room2) in the admin program.
5. But, the zone's 'total users' number is still = 1, when I try to get zone.getAllUsersInZone(), I can get a LinkedList that contain 1 SocketChannel, but this SocketChannel is closed.

When this user try to login into the zone again, the error 'This user name is already taken.' will occur. How can I disconnect this user from server when the client program is closed?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 15 Dec 2008, 05:50

The userLost event is fired BEFORE the user is actually removed from the joined rooms.
This is done to allow the developer to check in which rooms the user is located and perform its application logic if necessary.

When this user try to login into the zone again, the error 'This user name is already taken.' will occur. How can I disconnect this user from server when the client program is closed?

I don't see how the two things can be connected as the userLost behavior is what it is normally expected.

We are aware of possible similar problems if you have an exception in your extension when dealing with the userLost event.
This happens only if you use Java extensions. If you make sure to trap any exception that might occur this should never happen.

Anyways we're addressing the issue on the next release by adding better error handling for that event behind the scenes.
Lapo
--
gotoAndPlay()
...addicted to flash games
jiaxintang
Posts: 7
Joined: 29 Nov 2008, 16:48

Postby jiaxintang » 17 Dec 2008, 00:41

Thank you. I found that there is an exception in roomLost function of zone extension. Now the user can be deleted from the server.

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 29 guests