log any and every time we closesocket

This commit is contained in:
Lion Kortlepel
2020-11-12 03:00:32 +01:00
parent 583819070b
commit c9f5ee9729
3 changed files with 6 additions and 0 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;
}