diff options
author | Justin Clark-Casey (justincc) | 2014-08-15 22:41:00 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-15 22:41:00 +0100 |
commit | 1d2933ca51feaad829ad5163903d18d8d3b16371 (patch) | |
tree | b7edc7a04bed51b5ba8a353c80a9888353807bc5 /OpenSim/Tools/pCampBot | |
parent | If a user moves back in sight of a child region before the agent has been clo... (diff) | |
download | opensim-SC-1d2933ca51feaad829ad5163903d18d8d3b16371.zip opensim-SC-1d2933ca51feaad829ad5163903d18d8d3b16371.tar.gz opensim-SC-1d2933ca51feaad829ad5163903d18d8d3b16371.tar.bz2 opensim-SC-1d2933ca51feaad829ad5163903d18d8d3b16371.tar.xz |
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).
Diffstat (limited to 'OpenSim/Tools/pCampBot')
-rw-r--r-- | OpenSim/Tools/pCampBot/Bot.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index fd9ae3f..c043186 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs | |||
@@ -214,10 +214,11 @@ namespace pCampBot | |||
214 | if (!updatedBehaviours.TryGetValue(abbreviatedName, out behaviour)) | 214 | if (!updatedBehaviours.TryGetValue(abbreviatedName, out behaviour)) |
215 | return false; | 215 | return false; |
216 | 216 | ||
217 | behaviour.Close(); | ||
218 | updatedBehaviours.Remove(abbreviatedName); | 217 | updatedBehaviours.Remove(abbreviatedName); |
219 | Behaviours = updatedBehaviours; | 218 | Behaviours = updatedBehaviours; |
220 | 219 | ||
220 | behaviour.Close(); | ||
221 | |||
221 | return true; | 222 | return true; |
222 | } | 223 | } |
223 | 224 | ||
@@ -299,7 +300,7 @@ namespace pCampBot | |||
299 | ConnectionState = ConnectionState.Disconnecting; | 300 | ConnectionState = ConnectionState.Disconnecting; |
300 | 301 | ||
301 | foreach (IBehaviour behaviour in Behaviours.Values) | 302 | foreach (IBehaviour behaviour in Behaviours.Values) |
302 | behaviour.Interrupt(); | 303 | behaviour.Close(); |
303 | 304 | ||
304 | Client.Network.Logout(); | 305 | Client.Network.Logout(); |
305 | } | 306 | } |