From 158de95bde7cdee09334c40baee5122fd8f196e2 Mon Sep 17 00:00:00 2001
From: diva
Date: Sat, 3 Jan 2009 07:05:33 +0000
Subject: Another interregion comms change that will not work well with
previous versions. This commit moves InformRegionOfChildAgent from OGS1 to
RESTComms, effectively having the complete child agent life cycle over REST:
create=POST, update=PUT, close=DELETE. Additional changes include more
functions in the IHyperlink interface, and some refactorings in the HG code
for better reuse in RESTComms.
---
.../Communications/Hypergrid/HGGridServices.cs | 55 +++++++++++++++-------
.../Hypergrid/HGGridServicesGridMode.cs | 2 +-
.../Hypergrid/HGGridServicesStandalone.cs | 2 +-
3 files changed, 39 insertions(+), 20 deletions(-)
(limited to 'OpenSim/Region/Communications')
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
index 691cd4a..fc68ba2 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
@@ -890,17 +890,8 @@ namespace OpenSim.Region.Communications.Hypergrid
public virtual bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) { return false; }
- public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
+ public bool SendUserInformation(RegionInfo regInfo, AgentCircuitData agentData)
{
- // If we're here, it's because regionHandle is a remote, non-grided region
- m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle);
-
- RegionInfo regInfo = GetHyperlinkRegion(regionHandle);
- if (regInfo == null)
- return false;
-
- //ulong realHandle = regionHandle;
-
CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
if ((uinfo == null) || !IsGoingHome(uinfo, regInfo))
{
@@ -914,6 +905,33 @@ namespace OpenSim.Region.Communications.Hypergrid
else
m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
+ // May need to change agent's name
+ if (IsLocalUser(uinfo))
+ {
+ agentData.firstname = agentData.firstname + "." + agentData.lastname;
+ agentData.lastname = "@" + serversInfo.UserURL.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
+ }
+
+ return true;
+ }
+
+ public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
+ {
+ // If we're here, it's because regionHandle is a remote, non-grided region
+ m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle);
+
+ RegionInfo regInfo = GetHyperlinkRegion(regionHandle);
+ if (regInfo == null)
+ return false;
+
+ //ulong realHandle = regionHandle;
+
+ if (!SendUserInformation(regInfo, agentData))
+ {
+ m_log.Warn("[HGrid]: Failed to inform remote region of user.");
+ //return false;
+ }
+
try
{
// ... and then
@@ -939,12 +957,14 @@ namespace OpenSim.Region.Communications.Hypergrid
if (remObject != null)
{
sAgentCircuitData sag = new sAgentCircuitData(agentData);
- // May need to change agent's name
- if (IsLocalUser(uinfo))
- {
- sag.firstname = agentData.firstname + "." + agentData.lastname;
- sag.lastname = serversInfo.UserURL; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
- }
+ //CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
+
+ //// May need to change agent's name
+ //if (IsLocalUser(uinfo))
+ //{
+ // sag.firstname = agentData.firstname + "." + agentData.lastname;
+ // sag.lastname = serversInfo.UserURL; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
+ //}
retValue = remObject.InformRegionOfChildAgent(regionHandle, sag);
}
else
@@ -1158,7 +1178,7 @@ namespace OpenSim.Region.Communications.Hypergrid
///
///
///
- protected bool HGIncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
+ public void AdjustUserInformation(AgentCircuitData agentData)
{
CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
if ((uinfo != null) && (uinfo.UserProfile != null) &&
@@ -1174,7 +1194,6 @@ namespace OpenSim.Region.Communications.Hypergrid
}
//else
// Console.WriteLine("---------------> Foreign User!");
- return true;
}
#endregion
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
index 83c087d..0448692 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
@@ -274,7 +274,7 @@ namespace OpenSim.Region.Communications.Hypergrid
///
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
- HGIncomingChildAgent(regionHandle, agentData);
+ AdjustUserInformation(agentData);
m_log.Info("[HGrid]: Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname);
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
index cabc630..c160696 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
@@ -764,7 +764,7 @@ namespace OpenSim.Region.Communications.Hypergrid
///
public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
- HGIncomingChildAgent(regionHandle, agentData);
+ AdjustUserInformation(agentData);
m_log.Info("[HGrid]: " + gdebugRegionName + ": Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname);
--
cgit v1.1