From 582964800cc30e5ad08cf3be9a6a49fa96dd8b68 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 22 Feb 2008 19:44:46 +0000 Subject: * Moved all events except gridcomms and regioncomms over to Event Delegate instances to prevent event race conditions --- .../Framework/Communications/Capabilities/Caps.cs | 22 ++++++++++++++-------- OpenSim/Grid/UserServer/UserLoginService.cs | 7 +++++-- OpenSim/Region/Environment/Scenes/InnerScene.cs | 6 ++++-- OpenSim/Region/Environment/Scenes/SceneBase.cs | 4 +++- .../Region/Environment/Scenes/SceneObjectGroup.cs | 6 ++++-- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 7 +++++-- .../Region/Environment/Scenes/SimStatsReporter.cs | 7 +++++-- 7 files changed, 40 insertions(+), 19 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index a360dc3..0eb144c 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -475,6 +475,7 @@ namespace OpenSim.Region.Capabilities public class AssetUploader { public event UpLoadedAsset OnUpLoad; + private UpLoadedAsset handler001 = null; private string uploaderPath = String.Empty; private LLUUID newAssetID; @@ -528,10 +529,10 @@ namespace OpenSim.Region.Capabilities { SaveAssetToFile(m_assetName + ".jp2", data); } - - if (OnUpLoad != null) + handler001 = OnUpLoad; + if (handler001 != null) { - OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); + handler001(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); } return res; @@ -568,6 +569,8 @@ namespace OpenSim.Region.Capabilities { public event UpdateItem OnUpLoad; + private UpdateItem handler001 = null; + private string uploaderPath = String.Empty; private LLUUID inventoryItemID; private BaseHttpServer httpListener; @@ -595,10 +598,10 @@ namespace OpenSim.Region.Capabilities string res = String.Empty; LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); LLUUID assetID = LLUUID.Zero; - - if (OnUpLoad != null) + handler001 = OnUpLoad; + if (handler001 != null) { - assetID = OnUpLoad(inv, data); + assetID = handler001(inv, data); } uploadComplete.new_asset = assetID.ToString(); @@ -648,6 +651,8 @@ namespace OpenSim.Region.Capabilities { public event UpdateTaskScript OnUpLoad; + private UpdateTaskScript handler001 = null; + private string uploaderPath = String.Empty; private LLUUID inventoryItemID; private LLUUID primID; @@ -688,9 +693,10 @@ namespace OpenSim.Region.Capabilities string res = String.Empty; LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); - if (OnUpLoad != null) + handler001 = OnUpLoad; + if (handler001 != null) { - OnUpLoad(inventoryItemID, primID, isScriptRunning, data); + handler001(inventoryItemID, primID, isScriptRunning, data); } uploadComplete.item_id = inventoryItemID; diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index e45aacf..80899e8 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -51,6 +51,8 @@ namespace OpenSim.Grid.UserServer private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public event UserLoggedInAtLocation OnUserLoggedInAtLocation; + + private UserLoggedInAtLocation handler001 = null; public UserConfig m_config; @@ -214,9 +216,10 @@ namespace OpenSim.Grid.UserServer // Send XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); - if (OnUserLoggedInAtLocation != null) + handler001 = OnUserLoggedInAtLocation; + if (handler001 != null) { - OnUserLoggedInAtLocation(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos); + handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos); } } diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 38bcb03..fea6b2b 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -47,6 +47,7 @@ namespace OpenSim.Region.Environment.Scenes #region Events public event PhysicsCrash UnRecoverableError; + private PhysicsCrash handler001 = null; #endregion @@ -715,9 +716,10 @@ namespace OpenSim.Region.Environment.Scenes public void physicsBasedCrash() { - if (UnRecoverableError != null) + handler001 = UnRecoverableError; + if (handler001 != null) { - UnRecoverableError(); + handler001(); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 4e05682..3371912 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -160,7 +160,9 @@ namespace OpenSim.Region.Environment.Scenes public virtual void Restart(int seconds) { m_log.Error("[REGION]: passing Restart Message up the namespace"); - OnRestart(RegionInfo); + restart handler001 = OnRestart; + if (handler001 != null) + handler001(RegionInfo); } public virtual bool PresenceChildStatus(LLUUID avatarID) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 2e4135c..8fd9edb 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -54,6 +54,7 @@ namespace OpenSim.Region.Environment.Scenes protected ulong m_regionHandle; public event PrimCountTaintedDelegate OnPrimCountTainted; + private PrimCountTaintedDelegate handler001 = null; /// /// Signal whether the non-inventory attributes of any prims in the group have changed @@ -1525,9 +1526,10 @@ namespace OpenSim.Region.Environment.Scenes /// public void TriggerTainted() { - if (OnPrimCountTainted != null) + handler001 = OnPrimCountTainted; + if (handler001 != null) { - OnPrimCountTainted(); + handler001(); } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 2d01282..9b80444 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -116,6 +116,8 @@ namespace OpenSim.Region.Environment.Scenes private readonly List m_knownChildRegions = new List(); //neighbouring regions we have enabled a child agent in + private SignificantClientMovement handler001 = null; //OnSignificantClientMovement; + /// /// Implemented Control Flags @@ -1482,9 +1484,10 @@ namespace OpenSim.Region.Environment.Scenes if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > 0.5) { posLastSignificantMove = AbsolutePosition; - if (OnSignificantClientMovement != null) + + if (handler001 != null) { - OnSignificantClientMovement(m_controllingClient); + handler001(m_controllingClient); m_scene.NotifyMyCoarseLocationChange(); } } diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 90e09b0..d4868f3 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -39,6 +39,8 @@ namespace OpenSim.Region.Environment.Scenes public event SendStatResult OnSendStatsResult; + private SendStatResult handler001 = null; + private enum Stats : uint { TimeDilation = 0, @@ -245,9 +247,10 @@ namespace OpenSim.Region.Environment.Scenes statpack.Stat = sb; - if (OnSendStatsResult != null) + handler001 = OnSendStatsResult; + if (handler001 != null) { - OnSendStatsResult(statpack); + handler001(statpack); } resetvalues(); m_report.Enabled = true; -- cgit v1.1