mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
* First draft resolution of mantis 777, 734, 389 - scripts do not save in non-home regions
* Should work in multi-region standalone and grid modes * This should also solve other non-home region caps issues (map requests, RC client inventory requests, etc) * We now pass CAPS information on to the destination region on region crossing, and set up a CAPS object when an agent becomes a master * Current limitation is that this will only work if your http_listener_port is 9000 * This is a very early code cut (lots of bad practice, hard coding and inefficiency). However, I wanted to get this out there for feedback and my own sanity. Next few patches will clean up the mess.
This commit is contained in:
@@ -984,7 +984,7 @@ namespace OpenSim.Region.ClientStack
|
||||
agentData.child = false;
|
||||
agentData.firstname = m_firstName;
|
||||
agentData.lastname = m_lastName;
|
||||
agentData.CapsPath = String.Empty;
|
||||
agentData.CapsPath = m_scene.GetCapsPath(m_agentId);
|
||||
return agentData;
|
||||
}
|
||||
|
||||
|
||||
@@ -1649,53 +1649,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
if (regionHandle == m_regInfo.RegionHandle)
|
||||
{
|
||||
if (agent.CapsPath != String.Empty)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[CONNECTION DEBUGGING]: Setting up CAPS handler for avatar {0} at {1} in {2}",
|
||||
agent.AgentID, agent.CapsPath, RegionInfo.RegionName);
|
||||
capsPaths[agent.AgentID] = agent.CapsPath;
|
||||
|
||||
Caps cap =
|
||||
new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port,
|
||||
agent.CapsPath, agent.AgentID, m_dumpAssetsToFile);
|
||||
|
||||
Util.SetCapsURL(agent.AgentID,
|
||||
"http://" + m_regInfo.ExternalHostName + ":" + m_httpListener.Port.ToString() +
|
||||
"/CAPS/" + agent.CapsPath + "0000/");
|
||||
cap.RegisterHandlers();
|
||||
if (agent.child)
|
||||
{
|
||||
|
||||
}
|
||||
cap.AddNewInventoryItem = AddInventoryItem;
|
||||
cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
|
||||
cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
|
||||
cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS;
|
||||
|
||||
if (m_capsHandlers.ContainsKey(agent.AgentID))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[CONNECTION DEBUGGING]: Caps path already in use for avatar {0} in region {1}",
|
||||
agent.AgentID, RegionInfo.RegionName);
|
||||
|
||||
try
|
||||
{
|
||||
m_capsHandlers[agent.AgentID] = cap;
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[CONNECTION DEBUGGING]: Caught exception adding handler for avatar {0} at {1}",
|
||||
agent.AgentID, RegionInfo.RegionName);
|
||||
|
||||
// Fix for a potential race condition.
|
||||
m_capsHandlers.Add(agent.AgentID, cap);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_capsHandlers.Add(agent.AgentID, cap);
|
||||
}
|
||||
if (!agent.child)
|
||||
{
|
||||
AddCapsHandler(agent.AgentID);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1716,6 +1674,56 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
"[CONNECTION DEBUGGING]: Skipping this region for welcoming avatar {0} [{1}] at {2}",
|
||||
agent.AgentID, regionHandle, RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a caps handler for the given agent.
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
/// <param name="capsObjectPath"></param>
|
||||
public void AddCapsHandler(LLUUID agentId)
|
||||
{
|
||||
String capsObjectPath = GetCapsPath(agentId);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[CONNECTION DEBUGGING]: Setting up CAPS handler for avatar {0} at {1} in {2}",
|
||||
agentId, capsObjectPath, RegionInfo.RegionName);
|
||||
|
||||
Caps cap =
|
||||
new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port,
|
||||
capsObjectPath, agentId, m_dumpAssetsToFile);
|
||||
|
||||
cap.RegisterHandlers();
|
||||
|
||||
cap.AddNewInventoryItem = AddInventoryItem;
|
||||
cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
|
||||
cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
|
||||
cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS;
|
||||
|
||||
if (m_capsHandlers.ContainsKey(agentId))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[CONNECTION DEBUGGING]: Caps path already in use for avatar {0} in region {1}",
|
||||
agentId, RegionInfo.RegionName);
|
||||
|
||||
try
|
||||
{
|
||||
m_capsHandlers[agentId] = cap;
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[CONNECTION DEBUGGING]: Caught exception adding handler for avatar {0} at {1}",
|
||||
agentId, RegionInfo.RegionName);
|
||||
|
||||
// Fix for a potential race condition.
|
||||
m_capsHandlers.Add(agentId, cap);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_capsHandlers.Add(agentId, cap);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
@@ -196,5 +197,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// XXX These two methods are very temporary
|
||||
/// </summary>
|
||||
protected Dictionary<LLUUID, String> capsPaths = new Dictionary<LLUUID, String>();
|
||||
public string GetCapsPath(LLUUID agentId)
|
||||
{
|
||||
if (capsPaths.ContainsKey(agentId))
|
||||
{
|
||||
return capsPaths[agentId];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Try to teleport an agent to a new region.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="RegionHandle"></param>
|
||||
@@ -530,7 +530,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
|
||||
position, false);
|
||||
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
|
||||
string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
|
||||
|
||||
// TODO Should construct this behind a method
|
||||
string capsPath =
|
||||
"http://" + reg.ExternalHostName + ":" + 9000 + "/CAPS/" + circuitdata.CapsPath + "0000/";
|
||||
|
||||
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
|
||||
capsPath);
|
||||
avatar.MakeChildAgent();
|
||||
|
||||
@@ -545,6 +545,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
m_scene.SwapRootAgentCount(false);
|
||||
m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid);
|
||||
m_scene.AddCapsHandler(m_uuid);
|
||||
//if (!m_gotAllObjectsInScene)
|
||||
//{
|
||||
m_scene.SendAllSceneObjectsToClient(this);
|
||||
@@ -1616,7 +1617,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
if (res)
|
||||
{
|
||||
AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
|
||||
string capsPath = Util.GetCapsURL(m_controllingClient.AgentId);
|
||||
|
||||
// TODO Should construct this behind a method
|
||||
string capsPath =
|
||||
"http://" + neighbourRegion.ExternalHostName + ":" + 9000
|
||||
+ "/CAPS/" + circuitdata.CapsPath + "0000/";
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[CONNECTION DEBUGGING]: Sending new CAPS seed url {0} to avatar {1}", capsPath, m_uuid);
|
||||
|
||||
m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
|
||||
capsPath);
|
||||
MakeChildAgent();
|
||||
|
||||
Reference in New Issue
Block a user