Skip to content

Commit 9dc89bf

Browse files
committed
Prevent too many defenders on same PW planet, fix #3026
A race condition where two players join simultaneously can cause the count to skip past TeamSize, making the == check miss and leaving the challenge open for minutes until the timer fires. With >= the challenge triggers immediately even if the count overshoots.
1 parent d5184bb commit 9dc89bf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ZkLobbyServer/SpringieInterface/PlanetWarsMatchMaker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ private async Task JoinPlanetAttack(int targetPlanetId, string userName)
332332

333333
await conus.SendCommand(new PwJoinPlanetSuccess() { PlanetID = targetPlanetId });
334334

335-
if (attackOption.Attackers.Count == attackOption.TeamSize) await StartChallenge(attackOption);
335+
if (attackOption.Attackers.Count >= attackOption.TeamSize) await StartChallenge(attackOption);
336336
else await UpdateLobby();
337337
}
338338
}
@@ -361,7 +361,7 @@ private async Task JoinPlanetDefense(int targetPlanetID, string userName)
361361

362362
await conus.SendCommand(new PwJoinPlanetSuccess() { PlanetID = targetPlanetID });
363363

364-
if (Challenge.Defenders.Count == Challenge.TeamSize) await AcceptChallenge();
364+
if (Challenge.Defenders.Count >= Challenge.TeamSize) await AcceptChallenge();
365365
else await UpdateLobby();
366366
}
367367
}

0 commit comments

Comments
 (0)