* Converted the last of the events to the private delegate instance method to avoid race conditions.

afrisby-rexmerge
Teravus Ovares 2008-02-22 21:18:08 +00:00
parent b483faddf2
commit 9b675a6888
5 changed files with 116 additions and 62 deletions

View File

@ -46,7 +46,17 @@ namespace OpenSim.Framework
public event RegionUp OnRegionUp; public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate; public event ChildAgentUpdate OnChildAgentUpdate;
private ExpectUserDelegate handler001 = null; // OnExpectUser
private ExpectPrimDelegate handler002 = null; // OnExpectPrim;
private GenericCall2 handler003 = null; // OnExpectChildAgent;
private AgentCrossing handler004 = null; // OnAvatarCrossingIntoRegion;
private PrimCrossing handler005 = null; // OnPrimCrossingIntoRegion;
private UpdateNeighbours handler006 = null; // OnNeighboursUpdate;
private AcknowledgeAgentCross handler007 = null; // OnAcknowledgeAgentCrossed;
private AcknowledgePrimCross handler008 = null; // OnAcknowledgePrimCrossed;
private CloseAgentConnection handler009 = null; // OnCloseAgentConnection;
private RegionUp handler010 = null; // OnRegionUp;
private ChildAgentUpdate handler011 = null; // OnChildAgentUpdate;
public string debugRegionName = String.Empty; public string debugRegionName = String.Empty;
@ -58,9 +68,10 @@ namespace OpenSim.Framework
/// <returns></returns> /// <returns></returns>
public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
{ {
if (OnExpectUser != null) handler001 = OnExpectUser;
if (handler001 != null)
{ {
OnExpectUser(regionHandle, agent); handler001(regionHandle, agent);
return true; return true;
} }
@ -70,9 +81,10 @@ namespace OpenSim.Framework
public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData) public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData)
{ {
if (OnExpectPrim != null) handler002 = OnExpectPrim;
if (handler002 != null)
{ {
OnExpectPrim(regionHandle, primID, objData); handler002(regionHandle, primID, objData);
return true; return true;
} }
return false; return false;
@ -80,9 +92,10 @@ namespace OpenSim.Framework
public virtual bool TriggerRegionUp(RegionInfo region) public virtual bool TriggerRegionUp(RegionInfo region)
{ {
if (OnRegionUp != null) handler010 = OnRegionUp;
if (handler010 != null)
{ {
OnRegionUp(region); handler010(region);
return true; return true;
} }
return false; return false;
@ -90,9 +103,10 @@ namespace OpenSim.Framework
public virtual bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) public virtual bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{ {
if (OnChildAgentUpdate != null) handler011 = OnChildAgentUpdate;
if (handler011 != null)
{ {
OnChildAgentUpdate(regionHandle, cAgentData); handler011(regionHandle, cAgentData);
return true; return true;
} }
return false; return false;
@ -101,9 +115,10 @@ namespace OpenSim.Framework
public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position,
bool isFlying) bool isFlying)
{ {
if (OnAvatarCrossingIntoRegion != null) handler004 = OnAvatarCrossingIntoRegion;
if (handler004 != null)
{ {
OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); handler004(regionHandle, agentID, position, isFlying);
return true; return true;
} }
return false; return false;
@ -112,9 +127,10 @@ namespace OpenSim.Framework
public virtual bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, public virtual bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position,
bool isPhysical) bool isPhysical)
{ {
if (OnPrimCrossingIntoRegion != null) handler005 = OnPrimCrossingIntoRegion;
if (handler005 != null)
{ {
OnPrimCrossingIntoRegion(regionHandle, primID, position, isPhysical); handler005(regionHandle, primID, position, isPhysical);
return true; return true;
} }
return false; return false;
@ -122,9 +138,10 @@ namespace OpenSim.Framework
public virtual bool TriggerAcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID) public virtual bool TriggerAcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID)
{ {
if (OnAcknowledgeAgentCrossed != null) handler007 = OnAcknowledgeAgentCrossed;
if (handler007 != null)
{ {
OnAcknowledgeAgentCrossed(regionHandle, agentID); handler007(regionHandle, agentID);
return true; return true;
} }
return false; return false;
@ -132,9 +149,10 @@ namespace OpenSim.Framework
public virtual bool TriggerAcknowledgePrimCrossed(ulong regionHandle, LLUUID primID) public virtual bool TriggerAcknowledgePrimCrossed(ulong regionHandle, LLUUID primID)
{ {
if (OnAcknowledgePrimCrossed != null) handler008 = OnAcknowledgePrimCrossed;
if (handler008 != null)
{ {
OnAcknowledgePrimCrossed(regionHandle, primID); handler008(regionHandle, primID);
return true; return true;
} }
return false; return false;
@ -142,9 +160,10 @@ namespace OpenSim.Framework
public virtual bool TriggerCloseAgentConnection(ulong regionHandle, LLUUID agentID) public virtual bool TriggerCloseAgentConnection(ulong regionHandle, LLUUID agentID)
{ {
if (OnCloseAgentConnection != null) handler009 = OnCloseAgentConnection;
if (handler009 != null)
{ {
OnCloseAgentConnection(regionHandle, agentID); handler009(regionHandle, agentID);
return true; return true;
} }
@ -158,9 +177,10 @@ namespace OpenSim.Framework
/// <returns></returns> /// <returns></returns>
public virtual bool TriggerExpectChildAgent() public virtual bool TriggerExpectChildAgent()
{ {
if (OnExpectChildAgent != null) handler003 = OnExpectChildAgent;
if (handler003 != null)
{ {
OnExpectChildAgent(); handler003();
return true; return true;
} }
@ -175,9 +195,10 @@ namespace OpenSim.Framework
/// <returns></returns> /// <returns></returns>
public virtual bool TriggerOnNeighboursUpdate(List<RegionInfo> neighbours) public virtual bool TriggerOnNeighboursUpdate(List<RegionInfo> neighbours)
{ {
if (OnNeighboursUpdate != null) handler006 = OnNeighboursUpdate;
if (handler006 != null)
{ {
OnNeighboursUpdate(neighbours); handler006(neighbours);
return true; return true;
} }
@ -186,8 +207,9 @@ namespace OpenSim.Framework
public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
{ {
if (OnCloseAgentConnection != null) handler009 = OnCloseAgentConnection;
return OnCloseAgentConnection(regionHandle, agentID); if (handler009 != null)
return handler009(regionHandle, agentID);
return false; return false;
} }

View File

@ -214,6 +214,7 @@ namespace OpenSim.Region.ClientStack
private UpdateVector handler089 = null; //OnUpdatePrimGroupPosition; private UpdateVector handler089 = null; //OnUpdatePrimGroupPosition;
private UpdatePrimRotation handler090 = null; //OnUpdatePrimGroupRotation; private UpdatePrimRotation handler090 = null; //OnUpdatePrimGroupRotation;
private UpdatePrimGroupRotation handler091 = null; //OnUpdatePrimGroupMouseRotation; private UpdatePrimGroupRotation handler091 = null; //OnUpdatePrimGroupMouseRotation;
private PacketStats handler093 = null; // OnPacketStats;
/* Properties */ /* Properties */
@ -2818,9 +2819,10 @@ namespace OpenSim.Region.ClientStack
protected void SendPacketStats() protected void SendPacketStats()
{ {
if (OnPacketStats != null) handler093 = OnPacketStats;
if (handler093 != null)
{ {
OnPacketStats(m_packetsReceived - m_lastPacketsReceivedSentToScene, m_packetsSent - m_lastPacketsSentSentToScene, m_unAckedBytes); handler093(m_packetsReceived - m_lastPacketsReceivedSentToScene, m_packetsSent - m_lastPacketsSentSentToScene, m_unAckedBytes);
m_lastPacketsReceivedSentToScene = m_packetsReceived; m_lastPacketsReceivedSentToScene = m_packetsReceived;
m_lastPacketsSentSentToScene = m_packetsSent; m_lastPacketsSentSentToScene = m_packetsSent;
} }

View File

@ -55,6 +55,8 @@ namespace OpenSim.Region.Communications.Local
public event LoginToRegionEvent OnLoginToRegion; public event LoginToRegionEvent OnLoginToRegion;
private LoginToRegionEvent handler001 = null; // OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess, public LocalLoginService(UserManagerBase userManager, string welcomeMess,
CommunicationsLocal parent, NetworkServersInfo serversInfo, CommunicationsLocal parent, NetworkServersInfo serversInfo,
bool authenticate) bool authenticate)
@ -161,9 +163,10 @@ namespace OpenSim.Region.Communications.Local
_login.StartPos = new LLVector3(128, 128, 70); _login.StartPos = new LLVector3(128, 128, 70);
_login.CapsPath = capsPath; _login.CapsPath = capsPath;
if (OnLoginToRegion != null) handler001 = OnLoginToRegion;
if (handler001 != null)
{ {
OnLoginToRegion(currentRegion, _login); handler001(currentRegion, _login);
} }
} }
else else

View File

@ -59,6 +59,13 @@ namespace OpenSim.Region.Communications.OGS1
public event ChildAgentUpdate OnChildAgentUpdate; public event ChildAgentUpdate OnChildAgentUpdate;
public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection; public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection;
private InformRegionChild handler001 = null; // OnChildAgent;
private ExpectArrival handler002 = null; // OnArrival;
private InformRegionPrimGroup handler003 = null; // OnPrimGroupNear;
private PrimGroupArrival handler004 = null; // OnPrimGroupArrival;
private RegionUp handler005 = null; // OnRegionUp;
private ChildAgentUpdate handler006 = null; // OnChildAgentUpdate;
private TellRegionToCloseChildConnection handler007 = null; // OnTellRegionToCloseChildConnection;
static InterRegionSingleton() static InterRegionSingleton()
@ -76,64 +83,70 @@ namespace OpenSim.Region.Communications.OGS1
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{ {
if (OnChildAgent != null) handler001 = OnChildAgent;
if (handler001 != null)
{ {
return OnChildAgent(regionHandle, agentData); return handler001(regionHandle, agentData);
} }
return false; return false;
} }
public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
{ {
if (OnRegionUp != null) handler005 = OnRegionUp;
if (handler005 != null)
{ {
return OnRegionUp(sregion, regionhandle); return handler005(sregion, regionhandle);
} }
return false; return false;
} }
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate) public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate)
{ {
if (OnChildAgentUpdate != null) handler006 = OnChildAgentUpdate;
if (handler006 != null)
{ {
return OnChildAgentUpdate(regionHandle, cAgentUpdate); return handler006(regionHandle, cAgentUpdate);
} }
return false; return false;
} }
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{ {
if (OnArrival != null) handler002 = OnArrival;
if (handler002 != null)
{ {
return OnArrival(regionHandle, agentID, position, isFlying); return handler002(regionHandle, agentID, position, isFlying);
} }
return false; return false;
} }
public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
{ {
if (OnPrimGroupNear != null) handler003 = OnPrimGroupNear;
if (handler003 != null)
{ {
return OnPrimGroupNear(regionHandle, primID, position, isPhysical); return handler003(regionHandle, primID, position, isPhysical);
} }
return false; return false;
} }
public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData) public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
{ {
if (OnPrimGroupArrival != null) handler004 = OnPrimGroupArrival;
if (handler004 != null)
{ {
return OnPrimGroupArrival(regionHandle, primID, objData); return handler004(regionHandle, primID, objData);
} }
return false; return false;
} }
public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
{ {
if (OnTellRegionToCloseChildConnection != null) handler007 = OnTellRegionToCloseChildConnection;
if (handler007 != null)
{ {
return handler007(regionHandle, agentID);
return OnTellRegionToCloseChildConnection(regionHandle, agentID);
} }
return false; return false;
} }

View File

@ -58,7 +58,14 @@ namespace OpenSim.Region.Environment.Scenes
public event ChildAgentUpdate OnChildAgentUpdate; public event ChildAgentUpdate OnChildAgentUpdate;
public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
private AgentCrossing handler001 = null; // OnAvatarCrossingIntoRegion;
private ExpectUserDelegate handler002 = null; // OnExpectUser;
private ExpectPrimDelegate handler003 = null; // OnExpectPrim;
private CloseAgentConnection handler004 = null; // OnCloseAgentConnection;
private PrimCrossing handler005 = null; // OnPrimCrossingIntoRegion;
private RegionUp handler006 = null; // OnRegionUp;
private ChildAgentUpdate handler007 = null; // OnChildAgentUpdate;
private RemoveKnownRegionsFromAvatarList handler008 = null; // OnRemoveKnownRegionFromAvatar;
public KillObjectDelegate KillObject; public KillObjectDelegate KillObject;
public string _debugRegionName = String.Empty; public string _debugRegionName = String.Empty;
@ -125,27 +132,30 @@ namespace OpenSim.Region.Environment.Scenes
/// ///
protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent) protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
{ {
if (OnExpectUser != null) handler002 = OnExpectUser;
if (handler002 != null)
{ {
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname); //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname);
OnExpectUser(regionHandle, agent); handler002(regionHandle, agent);
} }
} }
protected bool newRegionUp(RegionInfo region) protected bool newRegionUp(RegionInfo region)
{ {
if (OnRegionUp != null) handler006 = OnRegionUp;
if (handler006 != null)
{ {
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName); //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
OnRegionUp(region); handler006(region);
} }
return true; return true;
} }
protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{ {
if (OnChildAgentUpdate != null) handler007 = OnChildAgentUpdate;
OnChildAgentUpdate(regionHandle, cAgentData); if (handler007 != null)
handler007(regionHandle, cAgentData);
return true; return true;
@ -153,36 +163,39 @@ namespace OpenSim.Region.Environment.Scenes
protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{ {
if (OnAvatarCrossingIntoRegion != null) handler001 = OnAvatarCrossingIntoRegion;
if (handler001 != null)
{ {
OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); handler001(regionHandle, agentID, position, isFlying);
} }
} }
protected void IncomingPrimCrossing(ulong regionHandle, LLUUID primID, String objXMLData) protected void IncomingPrimCrossing(ulong regionHandle, LLUUID primID, String objXMLData)
{ {
if (OnExpectPrim != null) handler003 = OnExpectPrim;
if (handler003 != null)
{ {
OnExpectPrim(regionHandle, primID, objXMLData); handler003(regionHandle, primID, objXMLData);
} }
} }
protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
{ {
if (OnPrimCrossingIntoRegion != null) handler005 = OnPrimCrossingIntoRegion;
if (handler005 != null)
{ {
OnPrimCrossingIntoRegion(regionHandle, primID, position, isPhysical); handler005(regionHandle, primID, position, isPhysical);
} }
} }
protected bool CloseConnection(ulong regionHandle, LLUUID agentID) protected bool CloseConnection(ulong regionHandle, LLUUID agentID)
{ {
m_log.Info("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID.ToString()); m_log.Info("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID.ToString());
handler004 = OnCloseAgentConnection;
if (OnCloseAgentConnection != null) if (handler004 != null)
{ {
return OnCloseAgentConnection(regionHandle, agentID); return handler004(regionHandle, agentID);
} }
return false; return false;
} }
@ -424,9 +437,10 @@ namespace OpenSim.Region.Environment.Scenes
// We remove the list of known regions from the agent's known region list through an event // We remove the list of known regions from the agent's known region list through an event
// to scene, because, if an agent logged of, it's likely that there will be no scene presence // to scene, because, if an agent logged of, it's likely that there will be no scene presence
// by the time we get to this part of the method. // by the time we get to this part of the method.
if (OnRemoveKnownRegionFromAvatar != null) handler008 = OnRemoveKnownRegionFromAvatar;
if (handler008 != null)
{ {
OnRemoveKnownRegionFromAvatar(agentID,regionlst); handler008(agentID, regionlst);
} }
} }