From b636bb0f9ec50252164da6e94f2f7b71af8afe6b Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 12 Nov 2008 19:12:33 +0000
Subject: * Stop the pointless passing of a scene's own region handler back to
it in region comms * Some scene methods ignored it, others did nothing if the
region handler given did not match their own (which would never be triggered)
---
.../Modules/InterGrid/OpenGridProtocolModule.cs | 2 +-
OpenSim/Region/Environment/Scenes/Scene.cs | 178 ++++++++++-----------
.../Scenes/SceneCommunicationService.cs | 39 +++--
3 files changed, 102 insertions(+), 117 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
index ba40571..5b06408 100644
--- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
@@ -546,7 +546,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(agentData.AgentID, userProfile);
// Call 'new user' event handler
- homeScene.NewUserConnection(reg.RegionHandle, agentData);
+ homeScene.NewUserConnection(agentData);
//string raCap = string.Empty;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index ceadf7a..0d0823e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2106,9 +2106,10 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public bool IncomingInterRegionPrimGroup(ulong regionHandle, UUID primID, string objXMLData, int XMLMethod)
+ public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod)
{
- m_log.Warn("[INTERREGION]: A new prim arrived from a neighbor");
+ m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID);
+
if (XMLMethod == 0)
{
SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData);
@@ -2702,51 +2703,42 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
+ public void NewUserConnection(AgentCircuitData agent)
{
- if (regionHandle == m_regInfo.RegionHandle)
+ if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
{
- if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
- {
- m_log.WarnFormat(
- "[CONNECTION DEBUGGING]: Denied access to: {0} [{1}] at {2} because the user is on the region banlist",
- agent.AgentID, regionHandle, RegionInfo.RegionName);
- }
+ m_log.WarnFormat(
+ "[CONNECTION DEBUGGING]: Denied access to: {0} at {1} because the user is on the region banlist",
+ agent.AgentID, RegionInfo.RegionName);
+ }
- capsPaths[agent.AgentID] = agent.CapsPath;
+ capsPaths[agent.AgentID] = agent.CapsPath;
- if (!agent.child)
- {
- AddCapsHandler(agent.AgentID);
+ if (!agent.child)
+ {
+ AddCapsHandler(agent.AgentID);
- // Honor parcel landing type and position.
- ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
- if (land != null)
+ // Honor parcel landing type and position.
+ ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
+ if (land != null)
+ {
+ if (land.landData.LandingType == (byte)1 && land.landData.UserLocation != Vector3.Zero)
{
- if (land.landData.LandingType == (byte)1 && land.landData.UserLocation != Vector3.Zero)
- {
- agent.startpos = land.landData.UserLocation;
- }
+ agent.startpos = land.landData.UserLocation;
}
}
+ }
- m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
- // rewrite session_id
- CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);
- if (userinfo != null)
- {
- userinfo.SessionID = agent.SessionID;
- }
- else
- {
- m_log.WarnFormat("[USERINFO CACHE]: We couldn't find a User Info record for {0}. This is usually an indication that the UUID we're looking up is invalid", agent.AgentID);
- }
+ m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
+ // rewrite session_id
+ CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);
+ if (userinfo != null)
+ {
+ userinfo.SessionID = agent.SessionID;
}
else
{
- m_log.WarnFormat(
- "[CONNECTION DEBUGGING]: Skipping this region for welcoming avatar {0} [{1}] at {2}",
- agent.AgentID, regionHandle, RegionInfo.RegionName);
+ m_log.WarnFormat("[USERINFO CACHE]: We couldn't find a User Info record for {0}. This is usually an indication that the UUID we're looking up is invalid", agent.AgentID);
}
}
@@ -2760,31 +2752,28 @@ namespace OpenSim.Region.Environment.Scenes
return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc);
}
- protected void HandleLogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message)
+ protected void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
{
- if (RegionInfo.RegionHandle == regionHandle)
+ ScenePresence loggingOffUser = null;
+ loggingOffUser = GetScenePresence(AvatarID);
+ if (loggingOffUser != null)
{
- ScenePresence loggingOffUser = null;
- loggingOffUser = GetScenePresence(AvatarID);
- if (loggingOffUser != null)
+ if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId)
{
- if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId)
- {
- loggingOffUser.ControllingClient.Kick(message);
- // Give them a second to receive the message!
- System.Threading.Thread.Sleep(1000);
- loggingOffUser.ControllingClient.Close(true);
- }
- else
- {
- m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate");
- }
+ loggingOffUser.ControllingClient.Kick(message);
+ // Give them a second to receive the message!
+ System.Threading.Thread.Sleep(1000);
+ loggingOffUser.ControllingClient.Close(true);
}
else
{
- m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString());
+ m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate");
}
}
+ else
+ {
+ m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString());
+ }
}
///
@@ -2865,42 +2854,38 @@ namespace OpenSim.Region.Environment.Scenes
///
/// Triggered when an agent crosses into this sim. Also happens on initial login.
///
- ///
///
///
///
- public virtual void AgentCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
+ public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{
- if (regionHandle == m_regInfo.RegionHandle)
+ ScenePresence presence;
+
+ lock (m_scenePresences)
{
- ScenePresence presence;
-
- lock (m_scenePresences)
+ m_scenePresences.TryGetValue(agentID, out presence);
+ }
+
+ if (presence != null)
+ {
+ try
{
- m_scenePresences.TryGetValue(agentID, out presence);
+ presence.MakeRootAgent(position, isFlying);
}
-
- if (presence != null)
- {
- try
- {
- presence.MakeRootAgent(position, isFlying);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[SCENE]: Unable to do agent crossing, exception {0}", e);
- }
- }
- else
+ catch (Exception e)
{
- m_log.ErrorFormat(
- "[SCENE]: Could not find presence for agent {0} crossing into scene {1}",
- agentID, RegionInfo.RegionName);
+ m_log.ErrorFormat("[SCENE]: Unable to do agent crossing, exception {0}", e);
}
}
+ else
+ {
+ m_log.ErrorFormat(
+ "[SCENE]: Could not find presence for agent {0} crossing into scene {1}",
+ agentID, RegionInfo.RegionName);
+ }
}
- public virtual bool IncomingChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
+ public virtual bool IncomingChildAgentDataUpdate(ChildAgentDataUpdate cAgentData)
{
ScenePresence childAgentUpdate = GetScenePresence(new UUID(cAgentData.AgentID));
if (childAgentUpdate != null)
@@ -2918,8 +2903,10 @@ namespace OpenSim.Region.Environment.Scenes
// Not Implemented:
//TODO: Do we need to pass the message on to one of our neighbors?
}
+
return true;
}
+
return false;
}
@@ -2928,29 +2915,28 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public bool CloseConnection(ulong regionHandle, UUID agentID)
+ public bool CloseConnection(UUID agentID)
{
- if (regionHandle == m_regionHandle)
+ ScenePresence presence = m_innerScene.GetScenePresence(agentID);
+
+ if (presence != null)
{
- ScenePresence presence = m_innerScene.GetScenePresence(agentID);
- if (presence != null)
- {
- // Nothing is removed here, so down count it as such
- // if (presence.IsChildAgent)
- // {
- // m_innerScene.removeUserCount(false);
- // }
- // else
- // {
- // m_innerScene.removeUserCount(true);
- // }
-
- // Tell a single agent to disconnect from the region.
- presence.ControllingClient.SendShutdownConnectionNotice();
-
- presence.ControllingClient.Close(true);
- }
+ // Nothing is removed here, so down count it as such
+ // if (presence.IsChildAgent)
+ // {
+ // m_innerScene.removeUserCount(false);
+ // }
+ // else
+ // {
+ // m_innerScene.removeUserCount(true);
+ // }
+
+ // Tell a single agent to disconnect from the region.
+ presence.ControllingClient.SendShutdownConnectionNotice();
+
+ presence.ControllingClient.Close(true);
}
+
return true;
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 540303a..830a63d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -155,22 +155,22 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
+ protected void NewUserConnection(AgentCircuitData agent)
{
handlerExpectUser = OnExpectUser;
if (handlerExpectUser != null)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname);
- handlerExpectUser(regionHandle, agent);
+ handlerExpectUser(agent);
}
}
- protected void GridLogOffUser(ulong regionHandle, UUID AgentID, UUID RegionSecret, string message)
+ protected void GridLogOffUser(UUID AgentID, UUID RegionSecret, string message)
{
handlerLogOffUser = OnLogOffUser;
if (handlerLogOffUser != null)
{
- handlerLogOffUser(regionHandle, AgentID, RegionSecret, message);
+ handlerLogOffUser(AgentID, RegionSecret, message);
}
}
@@ -185,31 +185,31 @@ namespace OpenSim.Region.Environment.Scenes
return true;
}
- protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
+ protected bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData)
{
handlerChildAgentUpdate = OnChildAgentUpdate;
if (handlerChildAgentUpdate != null)
- handlerChildAgentUpdate(regionHandle, cAgentData);
+ handlerChildAgentUpdate(cAgentData);
return true;
}
- protected void AgentCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying)
+ protected void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{
handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion;
if (handlerAvatarCrossingIntoRegion != null)
{
- handlerAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying);
+ handlerAvatarCrossingIntoRegion(agentID, position, isFlying);
}
}
- protected bool IncomingPrimCrossing(ulong regionHandle, UUID primID, String objXMLData, int XMLMethod)
+ protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod)
{
handlerExpectPrim = OnExpectPrim;
if (handlerExpectPrim != null)
{
- return handlerExpectPrim(regionHandle, primID, objXMLData, XMLMethod);
+ return handlerExpectPrim(primID, objXMLData, XMLMethod);
}
else
{
@@ -218,23 +218,25 @@ namespace OpenSim.Region.Environment.Scenes
}
- protected void PrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isPhysical)
+ protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical)
{
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
if (handlerPrimCrossingIntoRegion != null)
{
- handlerPrimCrossingIntoRegion(regionHandle, primID, position, isPhysical);
+ handlerPrimCrossingIntoRegion(primID, position, isPhysical);
}
}
- protected bool CloseConnection(ulong regionHandle, UUID agentID)
+ protected bool CloseConnection(UUID agentID)
{
- m_log.Info("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID.ToString());
+ m_log.Debug("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID);
+
handlerCloseAgentConnection = OnCloseAgentConnection;
if (handlerCloseAgentConnection != null)
{
- return handlerCloseAgentConnection(regionHandle, agentID);
+ return handlerCloseAgentConnection(agentID);
}
+
return false;
}
@@ -416,8 +418,6 @@ namespace OpenSim.Region.Environment.Scenes
// yes, we're notifying ourselves.
if (handlerRegionUp != null)
handlerRegionUp(region);
-
-
}
else
{
@@ -726,7 +726,7 @@ namespace OpenSim.Region.Environment.Scenes
{
SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList());
SendCloseChildAgentConnections(avatar.UUID, childRegions);
- CloseConnection(m_regionInfo.RegionHandle, avatar.UUID);
+ CloseConnection(avatar.UUID);
}
// if (teleport success) // seems to be always success here
// the user may change their profile information in other region,
@@ -763,7 +763,7 @@ namespace OpenSim.Region.Environment.Scenes
}
///
- ///
+ /// Inform a neighbouring region that an avatar is about to cross into it.
///
///
///
@@ -778,7 +778,6 @@ namespace OpenSim.Region.Environment.Scenes
return m_commsProvider.InterRegion.InformRegionOfPrimCrossing(regionhandle, primID, objData, XMLMethod);
}
-
public Dictionary GetGridSettings()
{
return m_commsProvider.GridService.GetGridSettings();
--
cgit v1.1