Merge branch 'hg16' into mantis5110

viewer-2-initial-appearance
Jonathan Freedman 2010-10-22 18:34:50 -04:00
commit 38e76d71ac
25 changed files with 214 additions and 193 deletions

View File

@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities
/// <returns></returns> /// <returns></returns>
public static string GetCapsSeedPath(string capsObjectPath) public static string GetCapsSeedPath(string capsObjectPath)
{ {
return "/CAPS/" + capsObjectPath + "0000/"; return "CAPS/" + capsObjectPath + "0000/";
} }
/// <summary> /// <summary>

View File

@ -115,8 +115,20 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
public string ServerURI public string ServerURI
{ {
get { return m_serverURI; } get {
set { m_serverURI = value; } if ( m_serverURI != string.Empty ) {
return m_serverURI;
} else {
return "http://" + m_externalHostName + ":" + m_httpPort + "/";
}
}
set {
if ( value.EndsWith("/") ) {
m_serverURI = value;
} else {
m_serverURI = value + '/';
}
}
} }
protected string m_serverURI; protected string m_serverURI;
@ -141,6 +153,7 @@ namespace OpenSim.Framework
public SimpleRegionInfo() public SimpleRegionInfo()
{ {
m_serverURI = string.Empty;
} }
public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@ -150,6 +163,7 @@ namespace OpenSim.Framework
m_internalEndPoint = internalEndPoint; m_internalEndPoint = internalEndPoint;
m_externalHostName = externalUri; m_externalHostName = externalUri;
m_serverURI = string.Empty;
} }
public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
@ -160,6 +174,7 @@ namespace OpenSim.Framework
m_externalHostName = externalUri; m_externalHostName = externalUri;
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
m_serverURI = string.Empty;
} }
public SimpleRegionInfo(RegionInfo ConvertFrom) public SimpleRegionInfo(RegionInfo ConvertFrom)
@ -449,6 +464,7 @@ namespace OpenSim.Framework
configMember = configMember =
new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
m_serverURI = string.Empty;
} }
public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@ -458,10 +474,12 @@ namespace OpenSim.Framework
m_internalEndPoint = internalEndPoint; m_internalEndPoint = internalEndPoint;
m_externalHostName = externalUri; m_externalHostName = externalUri;
m_serverURI = string.Empty;
} }
public RegionInfo() public RegionInfo()
{ {
m_serverURI = string.Empty;
} }
public EstateSettings EstateSettings public EstateSettings EstateSettings
@ -551,10 +569,23 @@ namespace OpenSim.Framework
/// <summary> /// <summary>
/// A well-formed URI for the host region server (namely "http://" + ExternalHostName) /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
/// </summary> /// </summary>
public string ServerURI public string ServerURI
{ {
get { return m_serverURI; } get {
set { m_serverURI = value; } if ( m_serverURI != string.Empty ) {
return m_serverURI;
} else {
return "http://" + m_externalHostName + ":" + m_httpPort + "/";
}
}
set {
if ( value.EndsWith("/") ) {
m_serverURI = value;
} else {
m_serverURI = value + '/';
}
}
} }
public string RegionName public string RegionName

View File

@ -327,8 +327,8 @@ namespace OpenSim
//regionInfo.originRegionID = regionInfo.RegionID; //regionInfo.originRegionID = regionInfo.RegionID;
// set initial ServerURI // set initial ServerURI
regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port;
regionInfo.HttpPort = m_httpServerPort; regionInfo.HttpPort = m_httpServerPort;
regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/";
regionInfo.osSecret = m_osSecret; regionInfo.osSecret = m_osSecret;

View File

@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
IClientAPI client; IClientAPI client;
if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
{ {
//m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
return; return;
} }

View File

@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
try try
{ {
XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000); XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000);
Hashtable responseData = (Hashtable)GridResp.Value; Hashtable responseData = (Hashtable)GridResp.Value;
@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
} }
catch (WebException e) catch (WebException e)
{ {
m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})", m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})",
reginfo.ExternalHostName, reginfo.HttpPort, e.Message); reginfo.ServerURI, e.Message);
} }
return false; return false;

View File

@ -197,8 +197,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.ControllingClient.SendTeleportFailed("Problem at destination"); sp.ControllingClient.SendTeleportFailed("Problem at destination");
return; return;
} }
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}",
finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI);
// Check that these are not the same coordinates // Check that these are not the same coordinates
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
@ -254,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}", "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}",
reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position); reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
uint newRegionX = (uint)(reg.RegionHandle >> 40); uint newRegionX = (uint)(reg.RegionHandle >> 40);
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
@ -327,35 +327,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// OK, it got this agent. Let's close some child agents // OK, it got this agent. Let's close some child agents
sp.CloseChildAgents(newRegionX, newRegionY); sp.CloseChildAgents(newRegionX, newRegionY);
IClientIPEndpoint ipepClient;
if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
#region IP Translation for NAT
IClientIPEndpoint ipepClient;
if (sp.ClientView.TryGet(out ipepClient))
{
capsPath
= "http://"
+ NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName)
+ ":"
+ finalDestination.HttpPort
+ CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
}
else
{
capsPath
= "http://"
+ finalDestination.ExternalHostName
+ ":"
+ finalDestination.HttpPort
+ CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
}
#endregion
if (eq != null)
{
#region IP Translation for NAT #region IP Translation for NAT
// Uses ipepClient above // Uses ipepClient above
if (sp.ClientView.TryGet(out ipepClient)) if (sp.ClientView.TryGet(out ipepClient))
@ -363,7 +338,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
} }
#endregion #endregion
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
if (eq != null)
{
eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); eq.EnableSimulator(destinationHandle, endPoint, sp.UUID);
// ES makes the client send a UseCircuitCode message to the destination, // ES makes the client send a UseCircuitCode message to the destination,
@ -382,8 +360,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
else else
{ {
agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
} }
// Expect avatar crossing is a heavy-duty function at the destination. // Expect avatar crossing is a heavy-duty function at the destination.
@ -516,8 +493,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
{ {
agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort + agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/";
"/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; m_log.Debug("Set callback URL to " + agent.CallbackURI);
} }
@ -842,8 +819,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
cAgent.Position = pos; cAgent.Position = pos;
if (isFlying) if (isFlying)
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
"/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
{ {
@ -868,10 +845,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
neighbourRegion.RegionHandle); neighbourRegion.RegionHandle);
return agent; return agent;
} }
// TODO Should construct this behind a method string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
string capsPath =
"http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort
+ "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/";
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
@ -1190,8 +1164,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
y = y / Constants.RegionSize; y = y / Constants.RegionSize;
m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
+ "/CAPS/" + a.CapsPath + "0000/";
string reason = String.Empty; string reason = String.Empty;

View File

@ -123,7 +123,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
{ {
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
m_log.Debug("GetfinalDestination serveruri -> " + real_destination.ServerURI);
return real_destination;
} }
return region; return region;
} }
@ -149,6 +151,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
{ {
m_log.Debug("CreateAgent " + reg.ServerURI + " " + finalDestination.ServerURI);
reason = string.Empty; reason = string.Empty;
logout = false; logout = false;
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);

View File

@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid
// DEPRECATED // DEPRECATED
responseMap["seed_capability"] responseMap["seed_capability"]
= OSD.FromString( = OSD.FromString(
regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
// REPLACEMENT // REPLACEMENT
responseMap["region_seed_capability"] responseMap["region_seed_capability"]
= OSD.FromString( = OSD.FromString(
regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);

View File

@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString();
regionimage = regionimage.Replace("-", ""); regionimage = regionimage.Replace("-", "");
m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage); m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage);
MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage);
MainServer.Instance.AddLLSDHandler( MainServer.Instance.AddLLSDHandler(
@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (mreg != null) if (mreg != null)
{ {
httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString();
lock (m_cachedRegionMapItemsAddress) lock (m_cachedRegionMapItemsAddress)
{ {
if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))

View File

@ -3738,9 +3738,12 @@ namespace OpenSim.Region.Framework.Scenes
// We have to wait until the viewer contacts this region after receiving EAC. // We have to wait until the viewer contacts this region after receiving EAC.
// That calls AddNewClient, which finally creates the ScenePresence // That calls AddNewClient, which finally creates the ScenePresence
m_log.Debug("ICADU -> pre wait");
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
m_log.Debug("ICADU -> post wait");
if (childAgentUpdate != null) if (childAgentUpdate != null)
{ {
m_log.Debug("ICADU -> not child agent!");
childAgentUpdate.ChildAgentDataUpdate(cAgentData); childAgentUpdate.ChildAgentDataUpdate(cAgentData);
return true; return true;
} }
@ -3756,7 +3759,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>true if we handled it.</returns> /// <returns>true if we handled it.</returns>
public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData)
{ {
//m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null) if (childAgentUpdate != null)
{ {

View File

@ -2925,7 +2925,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ChildAgentDataUpdate(AgentData cAgentData) public void ChildAgentDataUpdate(AgentData cAgentData)
{ {
//m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName);
if (!IsChildAgent) if (!IsChildAgent)
return; return;
@ -2976,6 +2976,8 @@ namespace OpenSim.Region.Framework.Scenes
public void CopyTo(AgentData cAgent) public void CopyTo(AgentData cAgent)
{ {
cAgent.CallbackURI = m_callbackURI;
cAgent.AgentID = UUID; cAgent.AgentID = UUID;
cAgent.RegionID = Scene.RegionInfo.RegionID; cAgent.RegionID = Scene.RegionInfo.RegionID;

View File

@ -124,6 +124,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
UUID uuid = UUID.Zero; UUID uuid = UUID.Zero;
string regionname = string.Empty; string regionname = string.Empty;
string gatekeeper_host = string.Empty; string gatekeeper_host = string.Empty;
string gatekeeper_serveruri = string.Empty;
string destination_serveruri = string.Empty;
int gatekeeper_port = 0; int gatekeeper_port = 0;
IPEndPoint client_ipaddress = null; IPEndPoint client_ipaddress = null;
@ -131,8 +133,13 @@ namespace OpenSim.Server.Handlers.Hypergrid
gatekeeper_host = args["gatekeeper_host"].AsString(); gatekeeper_host = args["gatekeeper_host"].AsString();
if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port);
if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null)
gatekeeper_serveruri = args["gatekeeper_serveruri"];
if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null)
destination_serveruri = args["destination_serveruri"];
GridRegion gatekeeper = new GridRegion(); GridRegion gatekeeper = new GridRegion();
gatekeeper.ServerURI = gatekeeper_serveruri;
gatekeeper.ExternalHostName = gatekeeper_host; gatekeeper.ExternalHostName = gatekeeper_host;
gatekeeper.HttpPort = (uint)gatekeeper_port; gatekeeper.HttpPort = (uint)gatekeeper_port;
gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
@ -173,6 +180,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
destination.RegionLocX = x; destination.RegionLocX = x;
destination.RegionLocY = y; destination.RegionLocY = y;
destination.RegionName = regionname; destination.RegionName = regionname;
destination.ServerURI = destination_serveruri;
AgentCircuitData aCircuit = new AgentCircuitData(); AgentCircuitData aCircuit = new AgentCircuitData();
try try

View File

@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
protected override string AgentPath() protected override string AgentPath()
{ {
return "/foreignagent/"; return "foreignagent/";
} }
protected override string ObjectPath() protected override string ObjectPath()
{ {
return "/foreignobject/"; return "foreignobject/";
} }
public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason)
@ -86,12 +86,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI);
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
XmlRpcResponse response = null; XmlRpcResponse response = null;
try try
{ {
response = request.Send(uri, 10000); response = request.Send(info.ServerURI, 10000);
} }
catch (Exception e) catch (Exception e)
{ {
@ -108,8 +107,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
hash = (Hashtable)response.Value; hash = (Hashtable)response.Value;
//foreach (Object o in hash) foreach (Object o in hash)
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
try try
{ {
bool success = false; bool success = false;
@ -117,16 +116,20 @@ namespace OpenSim.Services.Connectors.Hypergrid
if (success) if (success)
{ {
UUID.TryParse((string)hash["uuid"], out regionID); UUID.TryParse((string)hash["uuid"], out regionID);
//m_log.Debug(">> HERE, uuid: " + uuid); m_log.Debug(">> HERE, uuid: " + regionID);
if ((string)hash["handle"] != null) if ((string)hash["handle"] != null)
{ {
realHandle = Convert.ToUInt64((string)hash["handle"]); realHandle = Convert.ToUInt64((string)hash["handle"]);
//m_log.Debug(">> HERE, realHandle: " + realHandle); m_log.Debug(">> HERE, realHandle: " + realHandle);
} }
if (hash["region_image"] != null) if (hash["region_image"] != null) {
imageURL = (string)hash["region_image"]; imageURL = (string)hash["region_image"];
if (hash["external_name"] != null) m_log.Debug(">> HERE, imageURL: " + imageURL);
}
if (hash["external_name"] != null) {
externalName = (string)hash["external_name"]; externalName = (string)hash["external_name"];
m_log.Debug(">> HERE, externalName: " + externalName);
}
} }
} }
@ -188,12 +191,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash); paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI);
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
XmlRpcResponse response = null; XmlRpcResponse response = null;
try try
{ {
response = request.Send(uri, 10000); response = request.Send(gatekeeper.ServerURI, 10000);
} }
catch (Exception e) catch (Exception e)
{ {
@ -219,38 +221,48 @@ namespace OpenSim.Services.Connectors.Hypergrid
GridRegion region = new GridRegion(); GridRegion region = new GridRegion();
UUID.TryParse((string)hash["uuid"], out region.RegionID); UUID.TryParse((string)hash["uuid"], out region.RegionID);
//m_log.Debug(">> HERE, uuid: " + region.RegionID); m_log.Debug(">> HERE, uuid: " + region.RegionID);
int n = 0; int n = 0;
if (hash["x"] != null) if (hash["x"] != null)
{ {
Int32.TryParse((string)hash["x"], out n); Int32.TryParse((string)hash["x"], out n);
region.RegionLocX = n; region.RegionLocX = n;
//m_log.Debug(">> HERE, x: " + region.RegionLocX); m_log.Debug(">> HERE, x: " + region.RegionLocX);
} }
if (hash["y"] != null) if (hash["y"] != null)
{ {
Int32.TryParse((string)hash["y"], out n); Int32.TryParse((string)hash["y"], out n);
region.RegionLocY = n; region.RegionLocY = n;
//m_log.Debug(">> HERE, y: " + region.RegionLocY); m_log.Debug(">> HERE, y: " + region.RegionLocY);
} }
if (hash["region_name"] != null) if (hash["region_name"] != null)
{ {
region.RegionName = (string)hash["region_name"]; region.RegionName = (string)hash["region_name"];
//m_log.Debug(">> HERE, name: " + region.RegionName); m_log.Debug(">> HERE, region_name: " + region.RegionName);
} }
if (hash["hostname"] != null) if (hash["hostname"] != null) {
region.ExternalHostName = (string)hash["hostname"]; region.ExternalHostName = (string)hash["hostname"];
m_log.Debug(">> HERE, hostname: " + region.ExternalHostName);
}
if (hash["http_port"] != null) if (hash["http_port"] != null)
{ {
uint p = 0; uint p = 0;
UInt32.TryParse((string)hash["http_port"], out p); UInt32.TryParse((string)hash["http_port"], out p);
region.HttpPort = p; region.HttpPort = p;
m_log.Debug(">> HERE, http_port: " + region.HttpPort);
} }
if (hash["internal_port"] != null) if (hash["internal_port"] != null)
{ {
int p = 0; int p = 0;
Int32.TryParse((string)hash["internal_port"], out p); Int32.TryParse((string)hash["internal_port"], out p);
region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
}
if (hash["server_uri"] != null)
{
region.ServerURI = (string) hash["server_uri"];
m_log.Debug(">> HERE, server_uri: " + region.ServerURI);
} }
// Successful return // Successful return

View File

@ -232,12 +232,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
} }
// Add the input arguments // Add the input arguments
args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI);
args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName);
args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString());
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_name"] = OSD.FromString(destination.RegionName);
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
// 10/3/2010 // 10/3/2010
// I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.

View File

@ -84,8 +84,7 @@ namespace OpenSim.Services.Connectors
if (info != null) // just to be sure if (info != null) // just to be sure
{ {
XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; XmlRpcResponse response = request.Send(info.ServerURI, 10000);
XmlRpcResponse response = request.Send(uri, 10000);
if (response.IsFault) if (response.IsFault)
{ {
m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString);

View File

@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors
public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
{ {
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/";
//m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
WebRequest HelloNeighbourRequest = WebRequest.Create(uri); WebRequest HelloNeighbourRequest = WebRequest.Create(uri);

View File

@ -145,8 +145,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/";
OSDMap extraData = new OSDMap OSDMap extraData = new OSDMap
{ {
{ "ServerURI", OSD.FromString(regionInfo.ServerURI) }, { "ServerURI", OSD.FromString(regionInfo.ServerURI) },
@ -168,7 +166,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
{ "Name", regionInfo.RegionName }, { "Name", regionInfo.RegionName },
{ "MinPosition", minPosition.ToString() }, { "MinPosition", minPosition.ToString() },
{ "MaxPosition", maxPosition.ToString() }, { "MaxPosition", maxPosition.ToString() },
{ "Address", httpAddress }, { "Address", regionInfo.ServerURI },
{ "Enabled", "1" }, { "Enabled", "1" },
{ "ExtraData", OSDParser.SerializeJsonString(extraData) } { "ExtraData", OSDParser.SerializeJsonString(extraData) }
}; };

View File

@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation
protected virtual string AgentPath() protected virtual string AgentPath()
{ {
return "/agent/"; return "agent/";
} }
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
@ -104,26 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation
return false; return false;
} }
string uri = string.Empty; string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
// HACK -- Simian grid make it work!!!
if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:"))
uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
else
{
try
{
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/";
}
catch (Exception e)
{
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message);
reason = e.Message;
return false;
}
}
//Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);
AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
AgentCreateRequest.Method = "POST"; AgentCreateRequest.Method = "POST";
@ -277,17 +258,7 @@ namespace OpenSim.Services.Connectors.Simulation
private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
{ {
// Eventually, we want to use a caps url instead of the agentID // Eventually, we want to use a caps url instead of the agentID
string uri = string.Empty; string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/";
try
{
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/";
}
catch (Exception e)
{
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message);
return false;
}
//Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri);
HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
ChildUpdateRequest.Method = "PUT"; ChildUpdateRequest.Method = "PUT";
@ -385,8 +356,7 @@ namespace OpenSim.Services.Connectors.Simulation
{ {
agent = null; agent = null;
// Eventually, we want to use a caps url instead of the agentID // Eventually, we want to use a caps url instead of the agentID
string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
//Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "GET"; request.Method = "GET";
@ -407,7 +377,6 @@ namespace OpenSim.Services.Connectors.Simulation
sr = new StreamReader(webResponse.GetResponseStream()); sr = new StreamReader(webResponse.GetResponseStream());
reply = sr.ReadToEnd().Trim(); reply = sr.ReadToEnd().Trim();
//Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply);
} }
catch (WebException ex) catch (WebException ex)
@ -428,7 +397,6 @@ namespace OpenSim.Services.Connectors.Simulation
OSDMap args = Util.GetOSDMap(reply); OSDMap args = Util.GetOSDMap(reply);
if (args == null) if (args == null)
{ {
//Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply");
return false; return false;
} }
@ -437,7 +405,6 @@ namespace OpenSim.Services.Connectors.Simulation
return true; return true;
} }
//Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
return false; return false;
} }
@ -479,18 +446,8 @@ namespace OpenSim.Services.Connectors.Simulation
public bool CloseAgent(GridRegion destination, UUID id) public bool CloseAgent(GridRegion destination, UUID id)
{ {
string uri = string.Empty; string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
try
{
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
}
catch (Exception e)
{
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
return false;
}
//Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
WebRequest request = WebRequest.Create(uri); WebRequest request = WebRequest.Create(uri);
request.Method = "DELETE"; request.Method = "DELETE";
@ -538,7 +495,7 @@ namespace OpenSim.Services.Connectors.Simulation
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
{ {
string uri string uri
= "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; = destination.ServerURI + ObjectPath() + sog.UUID + "/";
//m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
WebRequest ObjectCreateRequest = WebRequest.Create(uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri);

View File

@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n",
r.RegionName, r.RegionID, r.RegionName, r.RegionID,
String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"],
r.Data["owner_uuid"].ToString(), flags.ToString())); r.Data["owner_uuid"].ToString(), flags.ToString()));
} }
return; return;

View File

@ -126,11 +126,12 @@ namespace OpenSim.Services.GridService
if (MainConsole.Instance != null) if (MainConsole.Instance != null)
{ {
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand);
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region",
"Link a hypergrid region", RunCommand); "legacy-link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
"Link a hypergrid region (deprecated)", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
"unlink-region <local name> or <HostName>:<HttpPort> <cr>", "unlink-region <local name>",
"Unlink a hypergrid region", RunCommand); "Unlink a hypergrid region", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
"Set local coordinate to map HG regions to", RunCommand); "Set local coordinate to map HG regions to", RunCommand);
@ -199,27 +200,32 @@ namespace OpenSim.Services.GridService
return null; return null;
} }
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
{
return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason);
}
// From the command line and the 2 above public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason)
public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
{ {
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
reason = string.Empty; reason = string.Empty;
regInfo = new GridRegion(); regInfo = new GridRegion();
regInfo.RegionName = externalRegionName; if ( externalPort > 0)
regInfo.HttpPort = externalPort; regInfo.HttpPort = externalPort;
else
regInfo.HttpPort = 0;
if ( externalHostName != null)
regInfo.ExternalHostName = externalHostName; regInfo.ExternalHostName = externalHostName;
else
regInfo.ExternalHostName = "0.0.0.0";
if ( serverURI != null)
regInfo.ServerURI = serverURI;
regInfo.RegionLocX = xloc; regInfo.RegionLocX = xloc;
regInfo.RegionLocY = yloc; regInfo.RegionLocY = yloc;
regInfo.ScopeID = scopeID; regInfo.ScopeID = scopeID;
// Big HACK for Simian Grid !!!
// We need to clean up all URLs used in OpenSim !!!
if (externalHostName.Contains("/"))
regInfo.ServerURI = externalHostName;
try try
{ {
regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
@ -250,8 +256,13 @@ namespace OpenSim.Services.GridService
} }
regInfo.RegionID = regionID; regInfo.RegionID = regionID;
if (regInfo.RegionName == string.Empty)
regInfo.RegionName = regInfo.ExternalHostName; if ( externalName == string.Empty )
regInfo.RegionName = regInfo.ServerURI;
else
regInfo.RegionName = externalName;
m_log.Debug("naming linked region " + regInfo.RegionName);
// Try get the map image // Try get the map image
//regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
@ -435,6 +446,21 @@ namespace OpenSim.Services.GridService
} }
private void RunLinkRegionCommand(string[] cmdparams)
{
int xloc, yloc;
string serverURI;
string remoteName = null;
xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
serverURI = cmdparams[2];
if (cmdparams.Length == 4)
remoteName = cmdparams[3];
string reason = string.Empty;
GridRegion regInfo;
TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason);
}
private void RunHGCommand(string command, string[] cmdparams) private void RunHGCommand(string command, string[] cmdparams)
{ {
if (command.Equals("link-mapping")) if (command.Equals("link-mapping"))
@ -456,6 +482,18 @@ namespace OpenSim.Services.GridService
} }
} }
else if (command.Equals("link-region")) else if (command.Equals("link-region"))
{
if (cmdparams.Length > 0 && cmdparams.Length < 5)
{
RunLinkRegionCommand(cmdparams);
}
else
{
LinkRegionCmdUsage();
}
return;
}
else if (command.Equals("legacy-link-region"))
{ {
if (cmdparams.Length < 3) if (cmdparams.Length < 3)
{ {
@ -509,12 +547,16 @@ namespace OpenSim.Services.GridService
int xloc, yloc; int xloc, yloc;
uint externalPort; uint externalPort;
string externalHostName; string externalHostName;
string serverURI;
try try
{ {
xloc = Convert.ToInt32(cmdparams[0]); xloc = Convert.ToInt32(cmdparams[0]);
yloc = Convert.ToInt32(cmdparams[1]); yloc = Convert.ToInt32(cmdparams[1]);
externalPort = Convert.ToUInt32(cmdparams[3]); externalPort = Convert.ToUInt32(cmdparams[3]);
externalHostName = cmdparams[2]; externalHostName = cmdparams[2];
if ( cmdparams.Length == 4 ) {
}
//internalPort = Convert.ToUInt32(cmdparams[4]); //internalPort = Convert.ToUInt32(cmdparams[4]);
//remotingPort = Convert.ToUInt32(cmdparams[5]); //remotingPort = Convert.ToUInt32(cmdparams[5]);
} }

View File

@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService
string regionimage = "regionImage" + region.RegionID.ToString(); string regionimage = "regionImage" + region.RegionID.ToString();
regionimage = regionimage.Replace("-", ""); regionimage = regionimage.Replace("-", "");
imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; imageURL = region.ServerURI + "index.php?method=" + regionimage;
return true; return true;
} }

View File

@ -134,23 +134,28 @@ namespace OpenSim.Services.HypergridService
public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
{ {
m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
m_log.Debug("LATG final server uri -> " + finalDestination.ServerURI );
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
GridRegion region = new GridRegion(gatekeeper); GridRegion region = new GridRegion(gatekeeper);
region.ServerURI = gatekeeper.ServerURI;
region.ExternalHostName = finalDestination.ExternalHostName;
region.InternalEndPoint = finalDestination.InternalEndPoint;
region.RegionName = finalDestination.RegionName; region.RegionName = finalDestination.RegionName;
region.RegionID = finalDestination.RegionID; region.RegionID = finalDestination.RegionID;
region.RegionLocX = finalDestination.RegionLocX; region.RegionLocX = finalDestination.RegionLocX;
region.RegionLocY = finalDestination.RegionLocY; region.RegionLocY = finalDestination.RegionLocY;
// Generate a new service session // Generate a new service session
agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
m_log.Debug("region ServerURI -> " + region.ServerURI);
bool success = false; bool success = false;
string myExternalIP = string.Empty; string myExternalIP = string.Empty;
string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; string gridName = gatekeeper.ServerURI;
if (m_GridName == gridName) if (m_GridName == gridName)
success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
else else
@ -159,7 +164,7 @@ namespace OpenSim.Services.HypergridService
if (!success) if (!success)
{ {
m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);
// restore the old travel info // restore the old travel info
lock (m_TravelingAgents) lock (m_TravelingAgents)
@ -210,7 +215,7 @@ namespace OpenSim.Services.HypergridService
m_TravelingAgents[agentCircuit.SessionID] = travel; m_TravelingAgents[agentCircuit.SessionID] = travel;
} }
travel.UserID = agentCircuit.AgentID; travel.UserID = agentCircuit.AgentID;
travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; travel.GridExternalName = region.ServerURI;
travel.ServiceToken = agentCircuit.ServiceSessionID; travel.ServiceToken = agentCircuit.ServiceSessionID;
if (old != null) if (old != null)
travel.ClientIPAddress = old.ClientIPAddress; travel.ClientIPAddress = old.ClientIPAddress;

View File

@ -115,8 +115,20 @@ namespace OpenSim.Services.Interfaces
/// </summary> /// </summary>
public string ServerURI public string ServerURI
{ {
get { return m_serverURI; } get {
set { m_serverURI = value; } if ( m_serverURI != string.Empty ) {
return m_serverURI;
} else {
return "http://" + m_externalHostName + ":" + m_httpPort + "/";
}
}
set {
if ( value.EndsWith("/") ) {
m_serverURI = value;
} else {
m_serverURI = value + '/';
}
}
} }
protected string m_serverURI; protected string m_serverURI;
@ -164,6 +176,7 @@ namespace OpenSim.Services.Interfaces
public GridRegion() public GridRegion()
{ {
m_serverURI = string.Empty;
} }
public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)

View File

@ -333,34 +333,7 @@ namespace OpenSim.Services.LLLoginService
private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient)
{ {
string capsSeedPath = String.Empty; SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
// 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!
// response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
#region IP Translation for NAT
if (ipepClient != null)
{
capsSeedPath
= "http://"
+ NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName)
+ ":"
+ destination.HttpPort
+ CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
}
else
{
capsSeedPath
= "http://"
+ destination.ExternalHostName
+ ":"
+ destination.HttpPort
+ CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
}
#endregion
SeedCapability = capsSeedPath;
} }
private void SetDefaultValues() private void SetDefaultValues()