From 940c79a66d09b8e6216377792ef12c587ad91589 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 15 Aug 2014 22:41:00 +0100 Subject: [PATCH] Resolve a small race condition on removing bot behaviours that might leave previous behaviour active Also closes behaviours on disconnect instead of interrupt, though this makes no practical difference. If existing behaviour is None, other added behavious will not take affect until None is removed (as this is an infinite wait until interrupted). --- OpenSim/Tools/pCampBot/Bot.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index 59e168f93c..37c30fd345 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -214,10 +214,11 @@ namespace pCampBot if (!updatedBehaviours.TryGetValue(abbreviatedName, out behaviour)) return false; - behaviour.Close(); updatedBehaviours.Remove(abbreviatedName); Behaviours = updatedBehaviours; + behaviour.Close(); + return true; } @@ -299,7 +300,7 @@ namespace pCampBot ConnectionState = ConnectionState.Disconnecting; foreach (IBehaviour behaviour in Behaviours.Values) - behaviour.Interrupt(); + behaviour.Close(); Client.Network.Logout(); }