From 13556cf1296d3c928d6eb286a6a1c9058c9ab5e7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Aug 2013 23:49:19 +0100 Subject: Fix a further bug in pCampbot connect where ignoring already connected bots was wrongly counted as a connect Also, only sleep when we actually perform a connection --- OpenSim/Tools/pCampBot/BotManager.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index c335a6e..50a77ed 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -277,11 +277,11 @@ namespace pCampBot connectBotThread.Start(); } - private void ConnectBotsInternal(int botcount) + private void ConnectBotsInternal(int botCount) { MainConsole.Instance.OutputFormat( "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_", - botcount, + botCount, m_loginUri, m_startUri, m_firstName, @@ -291,7 +291,9 @@ namespace pCampBot MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); MainConsole.Instance.OutputFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures); - for (int i = 0; i < botcount; i++) + int connectedBots = 0; + + for (int i = 0; i < m_bots.Count; i++) { lock (m_bots) { @@ -303,11 +305,17 @@ namespace pCampBot } if (m_bots[i].ConnectionState == ConnectionState.Disconnected) + { m_bots[i].Connect(); - } + connectedBots++; - // Stagger logins - Thread.Sleep(LoginDelay); + if (connectedBots >= botCount) + break; + + // Stagger logins + Thread.Sleep(LoginDelay); + } + } } ConnectingBots = false; -- cgit v1.1