* minor: Move GetRandomCapsPath() to a CapsUtil class

0.6.2-post-fixes
Justin Clarke Casey 2009-01-06 17:27:04 +00:00
parent 251387a391
commit b1c2cb3d82
6 changed files with 22 additions and 31 deletions

View File

@ -334,14 +334,6 @@ namespace OpenSim.Framework
return sb.ToString(); return sb.ToString();
} }
public static string GetRandomCapsPath()
{
UUID caps = UUID.Random();
string capsPath = caps.ToString();
capsPath = capsPath.Remove(capsPath.Length - 4, 4);
return capsPath;
}
public static int fast_distance2d(int x, int y) public static int fast_distance2d(int x, int y)
{ {
x = Math.Abs(x); x = Math.Abs(x);

View File

@ -37,6 +37,7 @@ using OpenSim.Data;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Capabilities;
namespace OpenSim.Grid.UserServer namespace OpenSim.Grid.UserServer
{ {
@ -309,7 +310,7 @@ namespace OpenSim.Grid.UserServer
response.RegionY = regionInfo.regionLocY; response.RegionY = regionInfo.regionLocY;
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
string capsPath = Util.GetRandomCapsPath(); string capsPath = CapsUtil.GetRandomCapsPath();
response.SeedCapability = regionInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; response.SeedCapability = regionInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
// Notify the target of an incoming user // Notify the target of an incoming user

View File

@ -35,6 +35,7 @@ using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Capabilities;
namespace OpenSim.Region.Communications.Local namespace OpenSim.Region.Communications.Local
{ {
@ -295,7 +296,7 @@ namespace OpenSim.Region.Communications.Local
response.RegionX = regionInfo.RegionLocX; response.RegionX = regionInfo.RegionLocX;
response.RegionY = regionInfo.RegionLocY; response.RegionY = regionInfo.RegionLocY;
string capsPath = Util.GetRandomCapsPath(); string capsPath = CapsUtil.GetRandomCapsPath();
// Don't use the following! It Fails for logging into any region not on the same port as the http server! // Don't use the following! It Fails for logging into any region not on the same port as the http server!
// Kept here so it doesn't happen again! // Kept here so it doesn't happen again!

View File

@ -42,6 +42,7 @@ using OpenMetaverse.Packets;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Capabilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
@ -377,7 +378,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
*/ */
} }
public OSD RequestRezAvatarMethod(string path, OSD request) public OSD RequestRezAvatarMethod(string path, OSD request)
{ {
//System.Console.WriteLine("[REQUESTREZAVATAR]: " + request.ToString()); //System.Console.WriteLine("[REQUESTREZAVATAR]: " + request.ToString());
@ -468,28 +468,28 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
// Generate a dummy agent for the user so we can get back a CAPS path // Generate a dummy agent for the user so we can get back a CAPS path
AgentCircuitData agentData = new AgentCircuitData(); AgentCircuitData agentData = new AgentCircuitData();
agentData.AgentID = LocalAgentID; agentData.AgentID = LocalAgentID;
agentData.BaseFolder=UUID.Zero; agentData.BaseFolder = UUID.Zero;
agentData.CapsPath=Util.GetRandomCapsPath(); agentData.CapsPath = CapsUtil.GetRandomCapsPath();
agentData.child = false; agentData.child = false;
agentData.circuitcode = (uint)(Util.RandomClass.Next()); agentData.circuitcode = (uint)(Util.RandomClass.Next());
agentData.firstname = FirstName; agentData.firstname = FirstName;
agentData.lastname = LastName; agentData.lastname = LastName;
agentData.SecureSessionID=UUID.Random(); agentData.SecureSessionID = UUID.Random();
agentData.SessionID=UUID.Random(); agentData.SessionID = UUID.Random();
agentData.startpos = new Vector3(128f, 128f, 100f); agentData.startpos = new Vector3(128f, 128f, 100f);
// Pre-Fill our region cache with information on the agent. // Pre-Fill our region cache with information on the agent.
UserAgentData useragent = new UserAgentData(); UserAgentData useragent = new UserAgentData();
useragent.AgentIP="unknown"; useragent.AgentIP = "unknown";
useragent.AgentOnline=true; useragent.AgentOnline = true;
useragent.AgentPort = (uint)0; useragent.AgentPort = (uint)0;
useragent.Handle = regionhandle; useragent.Handle = regionhandle;
useragent.InitialRegion = reg.originRegionID; useragent.InitialRegion = reg.originRegionID;
useragent.LoginTime=Util.UnixTimeSinceEpoch(); useragent.LoginTime = Util.UnixTimeSinceEpoch();
useragent.LogoutTime = 0; useragent.LogoutTime = 0;
useragent.Position=agentData.startpos; useragent.Position = agentData.startpos;
useragent.Region=reg.originRegionID; useragent.Region = reg.originRegionID;
useragent.SecureSessionID=agentData.SecureSessionID; useragent.SecureSessionID = agentData.SecureSessionID;
useragent.SessionID = agentData.SessionID; useragent.SessionID = agentData.SessionID;
UserProfileData userProfile = new UserProfileData(); UserProfileData userProfile = new UserProfileData();
@ -565,7 +565,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
string httpaddr = reg.ExternalHostName; string httpaddr = reg.ExternalHostName;
string urlport = reg.HttpPort.ToString(); string urlport = reg.HttpPort.ToString();
if (httpSSL) if (httpSSL)
{ {
rezHttpProtocol = "https://"; rezHttpProtocol = "https://";
@ -576,8 +575,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
httpaddr = httpsCN; httpaddr = httpsCN;
} }
// DEPRECIATED // DEPRECIATED
responseMap["seed_capability"] = OSD.FromString(regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/"); responseMap["seed_capability"] = OSD.FromString(regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/");

View File

@ -31,17 +31,16 @@ using System.Collections.Generic;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using OpenMetaverse;
using log4net; using log4net;
using OpenMetaverse;
using OSD = OpenMetaverse.StructuredData.OSD;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Capabilities;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Interfaces; using OpenSim.Region.Interfaces;
using OSD = OpenMetaverse.StructuredData.OSD;
namespace OpenSim.Region.Environment.Scenes.Hypergrid namespace OpenSim.Region.Environment.Scenes.Hypergrid
{ {
@ -189,7 +188,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
// brand new agent, let's create a new caps seed // brand new agent, let's create a new caps seed
agentCircuit.CapsPath = Util.GetRandomCapsPath(); agentCircuit.CapsPath = CapsUtil.GetRandomCapsPath();
} }
//if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))

View File

@ -36,6 +36,7 @@ using log4net;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Capabilities;
using OpenSim.Region.Interfaces; using OpenSim.Region.Interfaces;
using OSD = OpenMetaverse.StructuredData.OSD; using OSD = OpenMetaverse.StructuredData.OSD;
@ -393,7 +394,7 @@ namespace OpenSim.Region.Environment.Scenes
if (newRegions.Contains(neighbour.RegionHandle)) if (newRegions.Contains(neighbour.RegionHandle))
{ {
agent.CapsPath = Util.GetRandomCapsPath(); agent.CapsPath = CapsUtil.GetRandomCapsPath();
avatar.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath); avatar.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath);
seeds.Add(neighbour.RegionHandle, agent.CapsPath); seeds.Add(neighbour.RegionHandle, agent.CapsPath);
} }
@ -784,7 +785,7 @@ namespace OpenSim.Region.Environment.Scenes
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
// brand new agent, let's create a new caps seed // brand new agent, let's create a new caps seed
agentCircuit.CapsPath = Util.GetRandomCapsPath(); agentCircuit.CapsPath = CapsUtil.GetRandomCapsPath();
} }
// Let's create an agent there if one doesn't exist yet. // Let's create an agent there if one doesn't exist yet.