Sign in to follow this  
locke

Auto Reconnect Issue

Recommended Posts

First of all, I'm assuming this is not the expected behavior of the auto reconnect feature. If it is then just ignore this.

 

I was running around garden today when I started getting some lag and got disconnected. The reconnecting screen appear and after 50 seconds or so I was still not able to reconnect so I just hit Escape and got back to the login screen.

 

At this point I got up and went off to do some stuff. When I came back after 5 minutes or so I found that I was logged in (and dead of course).

So it seems that even after hitting escape to cancel the connection attempt it kept trying to reconnect, which is obviously not what you would expect I guess.

 

Cheers!

Share this post


Link to post
Share on other sites

I verified the code, and after pressing escape it shows the login screen, which is correct. From that point on all connections between the client and server are non existent, the socket is deleted and there is no connection established at all.

Share this post


Link to post
Share on other sites

There is definitely some corner case there not considered I reckon, I saw this happening several times.

I never looked at the code but maybe a synchronization issue where the client stops every connection to the server but the server might still reply to a previous connection and when the client receives it connects regardless of being on the login screen?

Share this post


Link to post
Share on other sites

When the client terminates the connection the object which contains the socket is deleted, thus it no longer exists.

 

Even if the server would eventually accept a reconnect, and sends data back to the client, that data won't get sent as the socket has been closed.

Closed sockets can't accept connections, they're closed.

 

If you wonder what the code looks like:

if (m_bEscPressed) {
ChangeGameMode(DEF_GAMEMODE_ONMAINMENU);
if ((dwTime - m_dwTime) > 1000) {
if (m_pLSock != NULL) {
delete m_pLSock;
m_pLSock = NULL;
}
if (m_pGSock != NULL) {
delete m_pGSock;
m_pGSock = NULL;
}
}
 
m_bEscPressed = false;
return;
}

Share this post


Link to post
Share on other sites

Interesting. What is "dwTime" and "m_dwTime"?

 

If I read the code correctly, you can press ESC, go to the main screen (ChangeGameMode(DEF_GAMEMODE_ONMAINMENU) ;) and then not close the socket if (dwTime - m_dwTime) <= 1000 (because it will only execute when > 1000) and return the method with the socket still open.

Edited by locke

Share this post


Link to post
Share on other sites

dwTime is a local variable which contains the current time (retrieved using the standard windows function timeGetTime())

m_dwTime is a global variable which contains the time when the last "change" has occured, either that be something occuring in the socket or the game mode being changed.

 

[edit]

Thx for pointing that piece of code out, it appears it NEVER gets executed because the m_dwTime variable is set by the on game mode change, thus the difference between dwTime and m_dwTime will always be ZERO, thus never more than 1000.

I've removed the condition, it'll be available on the next client patch.

Share this post


Link to post
Share on other sites

So is that global var updated when you call ChangeGameMode(DEF_GAMEMODE_ONMAINMENU)? If so then that "if" might never execute as it is right after the changeGameMode

 

Edit:

Just saw your edit. No problem! Glad I could help! :)

Edited by locke

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this