mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Go back to disconnecting bots in parallel since serially is too slow.
However, disconnecting now halts any current connection, with the possible exception of the single currently connecting bot.
This commit is contained in:
@@ -349,7 +349,7 @@ namespace pCampBot
|
||||
|
||||
foreach (Bot bot in botsToConnect)
|
||||
{
|
||||
if (DisconnectingBots)
|
||||
if (!ConnectingBots)
|
||||
{
|
||||
MainConsole.Instance.Output(
|
||||
"[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection");
|
||||
@@ -629,6 +629,8 @@ namespace pCampBot
|
||||
botsToDisconnectCount = Math.Min(botsToDisconnectCount, connectedBots.Count);
|
||||
}
|
||||
|
||||
DisconnectingBots = true;
|
||||
|
||||
Thread disconnectBotThread = new Thread(o => DisconnectBotsInternal(connectedBots, botsToDisconnectCount));
|
||||
|
||||
disconnectBotThread.Name = "Bots disconnection thread";
|
||||
@@ -637,7 +639,7 @@ namespace pCampBot
|
||||
|
||||
private void DisconnectBotsInternal(List<Bot> connectedBots, int disconnectCount)
|
||||
{
|
||||
DisconnectingBots = true;
|
||||
ConnectingBots = false;
|
||||
|
||||
MainConsole.Instance.OutputFormat("Disconnecting {0} bots", disconnectCount);
|
||||
|
||||
@@ -652,7 +654,7 @@ namespace pCampBot
|
||||
|
||||
if (thisBot.ConnectionState == ConnectionState.Connected)
|
||||
{
|
||||
thisBot.Disconnect();
|
||||
ThreadPool.QueueUserWorkItem(o => thisBot.Disconnect());
|
||||
disconnectedBots++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user