diff options
author | Justin Clark-Casey (justincc) | 2014-08-05 01:37:10 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-05 01:37:10 +0100 |
commit | 0e71e3889c4d3b12575fc8d40bde2e70dc7f5e56 (patch) | |
tree | 276870822245e73c8a12129cd5b9e010fb206f2c /OpenSim/Tools | |
parent | Put pCampbot "disconnect" command on separate thread like "connect" so that w... (diff) | |
download | opensim-SC-0e71e3889c4d3b12575fc8d40bde2e70dc7f5e56.zip opensim-SC-0e71e3889c4d3b12575fc8d40bde2e70dc7f5e56.tar.gz opensim-SC-0e71e3889c4d3b12575fc8d40bde2e70dc7f5e56.tar.bz2 opensim-SC-0e71e3889c4d3b12575fc8d40bde2e70dc7f5e56.tar.xz |
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.
Diffstat (limited to 'OpenSim/Tools')
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 8 |
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 | } |