mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-06 12:27:48 +00:00
feat(core): allow to debug KickPlayer() (#1549)
This commit is contained in:
@@ -144,7 +144,7 @@ WorldSession::~WorldSession()
|
||||
/// - If have unclosed socket, close it
|
||||
if (m_Socket)
|
||||
{
|
||||
m_Socket->CloseSocket();
|
||||
m_Socket->CloseSocket("WorldSession destructor");
|
||||
m_Socket->RemoveReference();
|
||||
m_Socket = NULL;
|
||||
}
|
||||
@@ -236,7 +236,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
#endif
|
||||
|
||||
if (m_Socket->SendPacket(*packet) == -1)
|
||||
m_Socket->CloseSocket();
|
||||
m_Socket->CloseSocket("m_Socket->SendPacket(*packet) == -1");
|
||||
}
|
||||
|
||||
/// Add an incoming packet to the queue
|
||||
@@ -255,7 +255,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
/// If necessary, kick the player because the client didn't send anything for too long
|
||||
/// (or they've been idling in character select)
|
||||
if (sWorld->getBoolConfig(CONFIG_CLOSE_IDLE_CONNECTIONS) && IsConnectionIdle())
|
||||
m_Socket->CloseSocket();
|
||||
m_Socket->CloseSocket("Client didn't send anything for too long");
|
||||
}
|
||||
|
||||
HandleTeleportTimeout(updater.ProcessLogout());
|
||||
@@ -611,10 +611,10 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
}
|
||||
|
||||
/// Kick a player out of the World
|
||||
void WorldSession::KickPlayer(bool setKicked)
|
||||
void WorldSession::KickPlayer(std::string const& reason, bool setKicked)
|
||||
{
|
||||
if (m_Socket)
|
||||
m_Socket->CloseSocket();
|
||||
m_Socket->CloseSocket(reason);
|
||||
|
||||
if (setKicked)
|
||||
SetKicked(true); // pussywizard: the session won't be left ingame for 60 seconds and to also kick offline session
|
||||
|
||||
@@ -247,7 +247,7 @@ class WorldSession
|
||||
}
|
||||
|
||||
void LogoutPlayer(bool save);
|
||||
void KickPlayer(bool setKicked = true);
|
||||
void KickPlayer(std::string const& reason, bool setKicked = true);
|
||||
|
||||
void QueuePacket(WorldPacket* new_packet);
|
||||
bool Update(uint32 diff, PacketFilter& updater);
|
||||
|
||||
@@ -119,8 +119,11 @@ bool WorldSocket::IsClosed(void) const
|
||||
return closing_;
|
||||
}
|
||||
|
||||
void WorldSocket::CloseSocket(void)
|
||||
void WorldSocket::CloseSocket(std::string const& reason)
|
||||
{
|
||||
if (!reason.empty())
|
||||
sLog->outDebug(LOG_FILTER_CLOSE_SOCKET, "Socket closed because of: %s", reason.c_str());
|
||||
|
||||
{
|
||||
ACE_GUARD (LockType, Guard, m_OutBufferLock);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class WorldSocket : public WorldHandler
|
||||
bool IsClosed (void) const;
|
||||
|
||||
/// Close the socket.
|
||||
void CloseSocket (void);
|
||||
void CloseSocket(std::string const& reason);
|
||||
|
||||
/// Get address of connected peer.
|
||||
const std::string& GetRemoteAddress (void) const;
|
||||
|
||||
@@ -169,7 +169,7 @@ class ReactorRunnable : protected ACE_Task_Base
|
||||
t = i;
|
||||
++i;
|
||||
|
||||
(*t)->CloseSocket();
|
||||
(*t)->CloseSocket("svc()");
|
||||
|
||||
sScriptMgr->OnSocketClose((*t), false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user