aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs8
1 files changed, 5 insertions, 3 deletions
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
349 349
350 foreach (Bot bot in botsToConnect) 350 foreach (Bot bot in botsToConnect)
351 { 351 {
352 if (DisconnectingBots) 352 if (!ConnectingBots)
353 { 353 {
354 MainConsole.Instance.Output( 354 MainConsole.Instance.Output(
355 "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection"); 355 "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection");
@@ -629,6 +629,8 @@ namespace pCampBot
629 botsToDisconnectCount = Math.Min(botsToDisconnectCount, connectedBots.Count); 629 botsToDisconnectCount = Math.Min(botsToDisconnectCount, connectedBots.Count);
630 } 630 }
631 631
632 DisconnectingBots = true;
633
632 Thread disconnectBotThread = new Thread(o => DisconnectBotsInternal(connectedBots, botsToDisconnectCount)); 634 Thread disconnectBotThread = new Thread(o => DisconnectBotsInternal(connectedBots, botsToDisconnectCount));
633 635
634 disconnectBotThread.Name = "Bots disconnection thread"; 636 disconnectBotThread.Name = "Bots disconnection thread";
@@ -637,7 +639,7 @@ namespace pCampBot
637 639
638 private void DisconnectBotsInternal(List<Bot> connectedBots, int disconnectCount) 640 private void DisconnectBotsInternal(List<Bot> connectedBots, int disconnectCount)
639 { 641 {
640 DisconnectingBots = true; 642 ConnectingBots = false;
641 643
642 MainConsole.Instance.OutputFormat("Disconnecting {0} bots", disconnectCount); 644 MainConsole.Instance.OutputFormat("Disconnecting {0} bots", disconnectCount);
643 645
@@ -652,7 +654,7 @@ namespace pCampBot
652 654
653 if (thisBot.ConnectionState == ConnectionState.Connected) 655 if (thisBot.ConnectionState == ConnectionState.Connected)
654 { 656 {
655 thisBot.Disconnect(); 657 ThreadPool.QueueUserWorkItem(o => thisBot.Disconnect());
656 disconnectedBots++; 658 disconnectedBots++;
657 } 659 }
658 } 660 }