Commit e8f3067b authored by Neoony's avatar Neoony
Browse files

v0.1 WIP25 -Bugfix to prevent cleaning up invalid socket handles

parent 90d9761c
Pipeline #4738 passed with stages
in 4 minutes
......@@ -21,7 +21,7 @@
//#include <emputils>
#include <socket>
#define PluginVer "v0.1 WIP24"
#define PluginVer "v0.1 WIP25"
public Plugin myinfo =
{
......@@ -98,7 +98,7 @@ int numPlayersS[10];
int maxPlayersS[10];
//Socket related
Handle socketx[10];
Handle socketx[10] = INVALID_HANDLE;
bool socketError[10];
char serverInfo[10][200];
Handle l_serverformat = INVALID_HANDLE;
......@@ -1299,10 +1299,14 @@ public Action CleanUpTmr(Handle timer, int ServerIndexx)
UpdateSQLServerDown(ServerIndexx);
}
CloseHandle(socketx[ServerIndexx]);
if (GetConVarInt(l_debug) == 1)
if (socketx[ServerIndexx] != INVALID_HANDLE)
{
PrintToServer("[L]CleanUp closed socket for server %i", ServerIndexx);
CloseHandle(socketx[ServerIndexx]);
socketx[ServerIndexx] = INVALID_HANDLE;
if (GetConVarInt(l_debug) == 1)
{
PrintToServer("[L]CleanUp closed socket for server %i", ServerIndexx);
}
}
}
}
......@@ -1419,7 +1423,15 @@ public OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, in
//CleanUp(ServerIndexx);
CloseHandle(socketx[ServerIndexx]);
if (socketx[ServerIndexx] != INVALID_HANDLE)
{
CloseHandle(socketx[ServerIndexx]);
socketx[ServerIndexx] = INVALID_HANDLE;
if (GetConVarInt(l_debug) == 1)
{
PrintToServer("[L]Closed socket for server %i", ServerIndexx);
}
}
if (GetConVarInt(l_debug) == 1)
{
......@@ -1429,10 +1441,14 @@ public OnSocketReceive(Handle socket, char[] receiveData, const int dataSize, in
public OnSocketDisconnected(Handle socket, int ServerIndexx)
{
CloseHandle(socketx[ServerIndexx]);
if (GetConVarInt(l_debug) == 1)
if (socketx[ServerIndexx] != INVALID_HANDLE)
{
PrintToServer("[L]Closed socket for server %i", ServerIndexx);
CloseHandle(socketx[ServerIndexx]);
socketx[ServerIndexx] = INVALID_HANDLE;
if (GetConVarInt(l_debug) == 1)
{
PrintToServer("[L]Closed socket for server %i", ServerIndexx);
}
}
}
......@@ -1449,10 +1465,14 @@ public OnSocketError(Handle socket, const errorType, const errorNum, int ServerI
UpdateSQLServerDown(ServerIndexx);
}
CloseHandle(socketx[ServerIndexx]);
if (GetConVarInt(l_debug) == 1)
if (socketx[ServerIndexx] != INVALID_HANDLE)
{
PrintToServer("[L]Closed socket for server %i", ServerIndexx);
CloseHandle(socketx[ServerIndexx]);
socketx[ServerIndexx] = INVALID_HANDLE;
if (GetConVarInt(l_debug) == 1)
{
PrintToServer("[L]Closed socket for server %i", ServerIndexx);
}
}
}
......
......@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "v0.1 WIP24"
"Latest" "v0.1 WIP25"
}
"Notes" "First release"
......@@ -42,6 +42,7 @@
"Notes" "WIP23: Fixed cleaning of sockets"
"Notes" "WIP23: Fixed sockets not timing out, timeout takes half of the l_refreshservers value"
"Notes" "WIP24: Attempt to fix an issue with local server fix sometimes not applying on main lobby"
"Notes" "WIP25: Bugfix to prevent cleaning up invalid socket handles"
}
"Files"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment