From 0e71e3889c4d3b12575fc8d40bde2e70dc7f5e56 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Aug 2014 01:37:10 +0100 Subject: 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. --- OpenSim/Tools/pCampBot/BotManager.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Tools') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index a872dbc..12cde18 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -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 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++; } } -- cgit v1.1