About Store Forum Documentation Contact



Post Reply 
Bug ConnectionServer::update
Author Message
cmontiel Offline
Member

Post: #1
Bug ConnectionServer::update
I tested my game last Friday with 7 people at same time. For some reason a client with Galaxy S2 did crash changing the world. The server didn't remove it. And even killing the application and restarting he was connected to the server (and his account logged). After 4 hours with his phone off I tried log in his account, and I couldn't because ::~Client destructor was never called.

I think there is a bug in ConnectionServer::update() when clients crash.

IRC: irc.freenode.net
Channel: #Esenthel
(This post was last modified: 04-26-2013 04:39 PM by cmontiel.)
04-26-2013 04:37 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Bug ConnectionServer::update
To my knowledge that is standard TCP socket behavior.

I did this:
run server on Windows
run client on Mac->connect to Win server
on Mac disable wi-fi while client is running
investigate client socket status on win server (it all reports normal as if connection is alive even though mac has broken connection)

I tried following codes for checking of any disconnect status:
Code:
int w=_socket.wait(0);
      int err=WSAGetLastError();
         Byte b;
         Int  l=_socket.receive(&b, 1);
         l=::recv((SOCKET)_socket.s, (Char8*)&b, 1, MSG_PEEK);
      int err2=WSAGetLastError();
      int error=0; int size=SIZE(error);
      int e=getsockopt((SOCKET)_socket.s, SOL_SOCKET, SO_ERROR, (Char8*)&error, &size);
but all appears normal.

So what I suggest is to every xx seconds send a message from client to server "I_AM_STILL_ALIVE".
And on the server check if any last message was received more than yy seconds ago, then manually disconnect that client.
04-27-2013 12:31 PM
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #3
RE: Bug ConnectionServer::update
I've tried to reproduce it again with Windows client but no luck.

I will try again with android client next week. There is a bug for sure.

Thanks for check update method. Send messages "I_AM_STILL_ALIVE" looks a good solution. On server should I check every 30 seconds for example?

IRC: irc.freenode.net
Channel: #Esenthel
04-27-2013 02:12 PM
Find all posts by this user Quote this message in a reply
Post Reply