Fixed a very nasty bug concerning the sender thread. SOCKETs were assumed to be kind of unique, but Windows tends to return the socket number of a socket which was just closed as new socket number in accept. This led to very strange behavior when the server was flooded with inits, because the sender thread still had entries for this socket number (which were not removed because they should just fail).

No longer use socket as key in maps, instead, use the session id. Only use the session id in the sender thread, "resolve" it to the socket only in the moment when it is needed. Outstanding requests will be detected to have an invalid session id then.
Also, as side effect, fixed an issue with two callback classes which were named the same and caused unexpected behavior.
This commit is contained in:
lotodore
2007-10-28 12:53:54 +00:00
parent 2fa888062f
commit fa7af40a49
20 changed files with 223 additions and 166 deletions
+3 -1
View File
@@ -21,6 +21,7 @@
#ifndef _SENDERCALLBACK_H_
#define _SENDERCALLBACK_H_
#include <net/sessiondata.h>
#include <net/socket_helper.h>
class SenderCallback
@@ -28,7 +29,8 @@ class SenderCallback
public:
virtual ~SenderCallback();
virtual void SignalNetError(SOCKET sock, int errorID, int osErrorID) = 0;
virtual bool GetSocketForSession(SessionId session, SOCKET &outSocket) = 0;
virtual void SignalNetError(SessionId session, int errorID, int osErrorID) = 0;
};
#endif