Core/Networking: Fixed unsafe access to _worldSession member in WorldSocket

(cherry picked from commit bed88e0dd4)

Core/Networking: Fixed deadlock in HandlePing if the client is about to be kicked for overspeed pings

(cherry picked from commit 3da0f7e409)

Core/Networking: Cleanup CloseSocket calls from read failures in WorldSocket

(cherry picked from commit 18343a7309)

Conflicts:
	src/server/game/Server/WorldSocket.cpp

Ref #14474
This commit is contained in:
Shauren
2015-04-04 23:07:16 +01:00
committed by DDuarte
parent 0df5cb972d
commit 548aa119ac
4 changed files with 85 additions and 41 deletions

View File

@@ -62,7 +62,7 @@ public:
return false;
#ifndef TC_SOCKET_USE_IOCP
std::unique_lock<std::mutex> guard(_writeLock, std::try_to_lock);
std::unique_lock<std::mutex> guard(_writeLock);
if (!guard)
return true;
@@ -140,6 +140,8 @@ public:
if (shutdownError)
TC_LOG_DEBUG("network", "Socket::CloseSocket: %s errored when shutting down socket: %i (%s)", GetRemoteIpAddress().to_string().c_str(),
shutdownError.value(), shutdownError.message().c_str());
OnClose();
}
/// Marks the socket for closing after write buffer becomes empty
@@ -148,6 +150,8 @@ public:
MessageBuffer& GetReadBuffer() { return _readBuffer; }
protected:
virtual void OnClose() { }
virtual void ReadHandler() = 0;
bool AsyncProcessQueue(std::unique_lock<std::mutex>&)