From c9f5ee9729ab42b6585a76d08e2b031766c3304b Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 12 Nov 2020 03:00:32 +0100 Subject: [PATCH] log any and every time we closesocket --- src/Lua/LuaSystem.cpp | 1 + src/Network/Sync.cpp | 3 +++ src/Network/TCPHandler.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/Lua/LuaSystem.cpp b/src/Lua/LuaSystem.cpp index b84943f..7b4527a 100644 --- a/src/Lua/LuaSystem.cpp +++ b/src/Lua/LuaSystem.cpp @@ -347,6 +347,7 @@ int lua_dropPlayer(lua_State* L) { } Respond(c, "C:Server:You have been Kicked from the server! " + Reason, true); c->SetStatus(-2); + info(Sec("Closing socket due to kick")); closesocket(c->GetTCPSock()); } else diff --git a/src/Network/Sync.cpp b/src/Network/Sync.cpp index 7d44d22..a9647e4 100644 --- a/src/Network/Sync.cpp +++ b/src/Network/Sync.cpp @@ -32,6 +32,7 @@ void STCPSend(Client* c, std::string Data) { } else if (BytesSent < 0) { if (c->GetStatus() > -1) c->SetStatus(-1); + info(Sec("Closing socket, BytesSent < 0")); closesocket(c->GetTCPSock()); } } @@ -106,11 +107,13 @@ bool STCPRecv(Client* c) { if (BytesRcv == 0) { if (c->GetStatus() > -1) c->SetStatus(-1); + info(Sec("Closing socket in STCP receive, BytesRcv == 0")); closesocket(c->GetTCPSock()); return false; } else if (BytesRcv < 0) { if (c->GetStatus() > -1) c->SetStatus(-1); + info(Sec("Closing socket in STCP receive, BytesRcv < 0")); closesocket(c->GetTCPSock()); return false; } diff --git a/src/Network/TCPHandler.cpp b/src/Network/TCPHandler.cpp index caa9dab..d8c4756 100644 --- a/src/Network/TCPHandler.cpp +++ b/src/Network/TCPHandler.cpp @@ -29,6 +29,7 @@ void TCPSend(Client*c,const std::string&Data){ return; } else if (Temp < 0) { if (c->GetStatus() > -1)c->SetStatus(-1); + info(Sec("Closing socket, Temp < 0")); closesocket(c->GetTCPSock()); return; } @@ -49,6 +50,7 @@ bool CheckBytes(Client*c,int32_t BytesRcv){ debug(Sec("(TCP) recv failed with error: ") + std::string(strerror(errno))); #endif // WIN32 if(c->GetStatus() > -1)c->SetStatus(-1); + info(Sec("Closing socket in CheckBytes, BytesRcv < 0")); closesocket(c->GetTCPSock()); return false; }