From 0e265889dd909d23b45175ec0e6f2d52725c008c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 8 Dec 2011 19:25:24 +0000 Subject: Remove unnecessary AgentCircuitData null check from Scene.AddNewClient(). The only caller is the LLUDP stack and this has to validate the UDP circuit itself, so we know that it exists. This allows us to eliminate another null check elsewhere and simplifies the method contract --- OpenSim/Framework/IScene.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 6919c48..e0e023d 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -74,9 +74,7 @@ namespace OpenSim.Framework /// /// The type of agent to add. /// - /// The scene agent if the new client was added. - /// Null if the required scene agent already existed or no scene agent was added because the required client circuit doesn't exist. - /// + /// The scene agent if the new client was added or if an agent that already existed. ISceneAgent AddNewClient(IClientAPI client, PresenceType type); /// -- cgit v1.1 From bc13855e6475ce2df051ad20acdd76756fb22555 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 8 Dec 2011 20:52:34 +0000 Subject: Reactivate BasicCircuitTests.TestAddClient() This checks that the initial UseCircuitCode packet is handled correctly for a normal client login. --- OpenSim/Framework/Util.cs | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 21cfc09..ed92b2d 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -58,10 +58,12 @@ namespace OpenSim.Framework /// /// None is used to execute the method in the same thread that made the call. It should only be used by regression /// test code that relies on predictable event ordering. + /// RegressionTest is used by regression tests. It fires the call synchronously and does not catch any exceptions. /// public enum FireAndForgetMethod { None, + RegressionTest, UnsafeQueueUserWorkItem, QueueUserWorkItem, BeginInvoke, @@ -1544,27 +1546,38 @@ namespace OpenSim.Framework public static void FireAndForget(System.Threading.WaitCallback callback, object obj) { - // When OpenSim interacts with a database or sends data over the wire, it must send this in en_US culture - // so that we don't encounter problems where, for instance, data is saved with a culture that uses commas - // for decimals places but is read by a culture that treats commas as number seperators. - WaitCallback realCallback = delegate(object o) - { - Culture.SetCurrentCulture(); + WaitCallback realCallback; - try - { - callback(o); - } - catch (Exception e) + if (FireAndForgetMethod == FireAndForgetMethod.RegressionTest) + { + // If we're running regression tests, then we want any exceptions to rise up to the test code. + realCallback = o => { Culture.SetCurrentCulture(); callback(o); }; + } + else + { + // When OpenSim interacts with a database or sends data over the wire, it must send this in en_US culture + // so that we don't encounter problems where, for instance, data is saved with a culture that uses commas + // for decimals places but is read by a culture that treats commas as number seperators. + realCallback = o => { - m_log.ErrorFormat( - "[UTIL]: Continuing after async_call_method thread terminated with exception {0}{1}", - e.Message, e.StackTrace); - } - }; + Culture.SetCurrentCulture(); + + try + { + callback(o); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[UTIL]: Continuing after async_call_method thread terminated with exception {0}{1}", + e.Message, e.StackTrace); + } + }; + } switch (FireAndForgetMethod) { + case FireAndForgetMethod.RegressionTest: case FireAndForgetMethod.None: realCallback.Invoke(obj); break; -- cgit v1.1