Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-10-23 00:21:42 +01:00
commit 7f74dc1b14
31 changed files with 299 additions and 156 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

@ -116,20 +116,8 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
public string ServerURI public string ServerURI
{ {
get { get { return m_serverURI; }
if ( m_serverURI != string.Empty ) { set { m_serverURI = value; }
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;
@ -154,7 +142,6 @@ 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)
@ -164,7 +151,6 @@ 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)
@ -175,7 +161,6 @@ 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)
@ -465,7 +450,6 @@ 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)
@ -475,12 +459,10 @@ 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
@ -570,23 +552,10 @@ 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 { get { return m_serverURI; }
if ( m_serverURI != string.Empty ) { set { m_serverURI = value; }
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

@ -112,6 +112,7 @@ namespace OpenSim.Framework.Serialization
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Mesh] = ASSET_EXTENSION_SEPARATOR + "mesh.llmesh";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this
@ -135,6 +136,7 @@ namespace OpenSim.Framework.Serialization
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"] = (sbyte)AssetType.Mesh;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder;

View File

@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
try try
{ {
//m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); // m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
@ -376,7 +376,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string path = request.RawUrl; string path = request.RawUrl;
string handlerKey = GetHandlerKey(request.HttpMethod, path); string handlerKey = GetHandlerKey(request.HttpMethod, path);
//m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); // m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
if (TryGetStreamHandler(handlerKey, out requestHandler)) if (TryGetStreamHandler(handlerKey, out requestHandler))
{ {

View File

@ -336,8 +336,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

@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
// sanity check: // sanity check:
if (c.Sender == null) if (c.Sender == null)
{ {
m_log.ErrorFormat("[CHAT] OnChatFromClient from {0} has empty Sender field!", sender); m_log.ErrorFormat("[CHAT]: OnChatFromClient from {0} has empty Sender field!", sender);
return; return;
} }
@ -234,7 +234,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
if (message.Length >= 1000) // libomv limit if (message.Length >= 1000) // libomv limit
message = message.Substring(0, 1000); message = message.Substring(0, 1000);
// m_log.DebugFormat("[CHAT]: DCTA: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, c.Type, sourceType); // m_log.DebugFormat(
// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}",
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType);
HashSet<UUID> receiverIDs = new HashSet<UUID>();
foreach (Scene s in m_scenes) foreach (Scene s in m_scenes)
{ {
@ -250,13 +254,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
// objects on a parcel with access restrictions // objects on a parcel with access restrictions
if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
{ {
TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType))
receiverIDs.Add(presence.UUID);
} }
} }
} }
); );
} }
(scene as Scene).EventManager.TriggerOnChatToClients(
fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
} }
static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); static private Vector3 CenterOfRegion = new Vector3(128, 128, 30);
@ -294,6 +302,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
} }
// m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
HashSet<UUID> receiverIDs = new HashSet<UUID>();
if (c.Scene != null) if (c.Scene != null)
{ {
((Scene)c.Scene).ForEachScenePresence ((Scene)c.Scene).ForEachScenePresence
@ -314,18 +324,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
(byte)sourceType, (byte)ChatAudibleLevel.Fully); (byte)sourceType, (byte)ChatAudibleLevel.Fully);
receiverIDs.Add(presence.UUID);
} }
); );
(c.Scene as Scene).EventManager.TriggerOnChatToClients(
fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
} }
} }
/// <summary>
protected virtual void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, /// Try to send a message to the given presence
/// </summary>
/// <param name="presence">The receiver</param>
/// <param name="fromPos"></param>
/// <param name="regionPos">/param>
/// <param name="fromAgentID"></param>
/// <param name="fromName"></param>
/// <param name="type"></param>
/// <param name="message"></param>
/// <param name="src"></param>
/// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a
/// precondition</returns>
protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
UUID fromAgentID, string fromName, ChatTypeEnum type, UUID fromAgentID, string fromName, ChatTypeEnum type,
string message, ChatSourceType src) string message, ChatSourceType src)
{ {
// don't send stuff to child agents // don't send stuff to child agents
if (presence.IsChildAgent) return; if (presence.IsChildAgent) return false;
Vector3 fromRegionPos = fromPos + regionPos; Vector3 fromRegionPos = fromPos + regionPos;
Vector3 toRegionPos = presence.AbsolutePosition + Vector3 toRegionPos = presence.AbsolutePosition +
@ -338,12 +363,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
type == ChatTypeEnum.Say && dis > m_saydistance || type == ChatTypeEnum.Say && dis > m_saydistance ||
type == ChatTypeEnum.Shout && dis > m_shoutdistance) type == ChatTypeEnum.Shout && dis > m_shoutdistance)
{ {
return; return false;
} }
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully);
return true;
} }
Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();

View File

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

View File

@ -33,6 +33,7 @@ using System.Reflection;
using System.Threading; using System.Threading;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using System.Xml.Linq;
using log4net; using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
@ -50,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version
/// bumps here should be compatible.
/// </summary>
public static int MAX_MAJOR_VERSION = 0;
protected TarArchiveReader archive; protected TarArchiveReader archive;
private UserAccount m_userInfo; private UserAccount m_userInfo;
@ -133,7 +140,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
while ((data = archive.ReadEntry(out filePath, out entryType)) != null) while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{ {
if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
{
LoadControlFile(filePath, data);
}
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{ {
if (LoadAsset(filePath, data)) if (LoadAsset(filePath, data))
successfulAssetRestores++; successfulAssetRestores++;
@ -461,5 +472,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false; return false;
} }
} }
/// <summary>
/// Load control file
/// </summary>
/// <param name="path"></param>
/// <param name="data"></param>
protected void LoadControlFile(string path, byte[] data)
{
XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
XElement archiveElement = doc.Element("archive");
int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value);
int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value);
string version = string.Format("{0}.{1}", majorVersion, minorVersion);
if (majorVersion > MAX_MAJOR_VERSION)
{
throw new Exception(
string.Format(
"The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below",
majorVersion, MAX_MAJOR_VERSION));
}
m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
}
} }
} }

View File

@ -123,9 +123,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
try try
{ {
// We're almost done. Just need to write out the control file now
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
m_archiveWriter.Close(); m_archiveWriter.Close();
} }
catch (Exception e) catch (Exception e)
@ -277,6 +274,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_archiveWriter = new TarArchiveWriter(m_saveStream); m_archiveWriter = new TarArchiveWriter(m_saveStream);
// Write out control file. This has to be done first so that subsequent loaders will see this file first
// XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive.");
if (inventoryFolder != null) if (inventoryFolder != null)
{ {
m_log.DebugFormat( m_log.DebugFormat(
@ -399,13 +401,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <returns></returns> /// <returns></returns>
public static string Create0p1ControlFile() public static string Create0p1ControlFile()
{ {
int majorVersion = 0, minorVersion = 1;
m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion);
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw); XmlTextWriter xtw = new XmlTextWriter(sw);
xtw.Formatting = Formatting.Indented; xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument(); xtw.WriteStartDocument();
xtw.WriteStartElement("archive"); xtw.WriteStartElement("archive");
xtw.WriteAttributeString("major_version", "0"); xtw.WriteAttributeString("major_version", majorVersion.ToString());
xtw.WriteAttributeString("minor_version", "1"); xtw.WriteAttributeString("minor_version", minorVersion.ToString());
xtw.WriteEndElement(); xtw.WriteEndElement();
xtw.Flush(); xtw.Flush();

View File

@ -327,10 +327,35 @@ 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))
@ -338,10 +363,7 @@ 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,
@ -360,7 +382,8 @@ 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 = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort
+ "/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.
@ -495,8 +518,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 = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort +
m_log.Debug("Set callback URL to " + agent.CallbackURI); "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/";
} }
@ -839,8 +862,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 = m_scene.RegionInfo.ServerURI + cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort +
"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))
{ {
@ -865,7 +888,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
neighbourRegion.RegionHandle); neighbourRegion.RegionHandle);
return agent; return agent;
} }
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); // TODO Should construct this behind a method
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);
@ -1193,7 +1219,8 @@ 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 = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + a.CapsPath + "0000/";
string reason = String.Empty; string reason = String.Empty;

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

@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version /// The maximum major version of OAR that we can read. Minor versions shouldn't need a max number since version
/// bumps here should be compatible. /// bumps here should be compatible.
/// </summary> /// </summary>
public static int MAX_MAJOR_VERSION = 0; public static int MAX_MAJOR_VERSION = 0;
@ -499,17 +499,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// </summary> /// </summary>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="data"></param> /// <param name="data"></param>
private void LoadControlFile(string path, byte[] data) protected void LoadControlFile(string path, byte[] data)
{ {
//Create the XmlNamespaceManager. XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
NameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
// Create the XmlParserContext.
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
XmlTextReader xtr
= new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
@ -548,7 +542,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString(); currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString();
} }
} }
} }
currentRegionSettings.Save(); currentRegionSettings.Save();

View File

@ -171,7 +171,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
// Write out control file // Write out control file. This has to be done first so that subsequent loaders will see this file first
// XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this
archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options)); archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options));
m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");

View File

@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.ErrorFormat( m_log.ErrorFormat(
"[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT); "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT);
m_log.Error("[ARCHIVER]: OAR save aborted."); m_log.Error("[ARCHIVER]: OAR save aborted. PLEASE DO NOT USE THIS OAR, IT WILL BE INCOMPLETE.");
} }
catch (Exception e) catch (Exception e)
{ {

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: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage); m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/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 = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString();
lock (m_cachedRegionMapItemsAddress) lock (m_cachedRegionMapItemsAddress)
{ {
if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))

View File

@ -296,6 +296,17 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat); public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
public event ChatFromClientEvent OnChatFromClient; public event ChatFromClientEvent OnChatFromClient;
/// <summary>
/// ChatToClientsEvent is triggered via ChatModule (or
/// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
/// received chat message if they satisfy various conditions (within audible range, etc.)
/// </summary>
public delegate void ChatToClientsEvent(
UUID senderID, HashSet<UUID> receiverIDs,
string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
ChatSourceType src, ChatAudibleLevel level);
public event ChatToClientsEvent OnChatToClients;
/// <summary> /// <summary>
/// ChatBroadcastEvent is called via Scene when a broadcast chat message /// ChatBroadcastEvent is called via Scene when a broadcast chat message
/// from world comes in /// from world comes in
@ -1628,6 +1639,30 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void TriggerOnChatToClients(
UUID senderID, HashSet<UUID> receiverIDs,
string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
ChatSourceType src, ChatAudibleLevel level)
{
ChatToClientsEvent handler = OnChatToClients;
if (handler != null)
{
foreach (ChatToClientsEvent d in handler.GetInvocationList())
{
try
{
d(senderID, receiverIDs, message, type, fromPos, fromName, src, level);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
{ {
ChatBroadcastEvent handlerChatBroadcast = OnChatBroadcast; ChatBroadcastEvent handlerChatBroadcast = OnChatBroadcast;

View File

@ -3329,8 +3329,6 @@ 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

@ -9637,10 +9637,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// do that one last, it will cause a ParcelPropertiesUpdate // do that one last, it will cause a ParcelPropertiesUpdate
landObject.SetMediaUrl(url); landObject.SetMediaUrl(url);
// now send to all (non-child) agents // now send to all (non-child) agents in the parcel
World.ForEachScenePresence(delegate(ScenePresence sp) World.ForEachScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent) if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID))
{ {
sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL,
landData.MediaID, landData.MediaID,
@ -9670,10 +9670,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// the commandList contained a start/stop/... command, too // the commandList contained a start/stop/... command, too
if (presence == null) if (presence == null)
{ {
// send to all (non-child) agents // send to all (non-child) agents in the parcel
World.ForEachScenePresence(delegate(ScenePresence sp) World.ForEachScenePresence(delegate(ScenePresence sp)
{ {
if (!sp.IsChildAgent) if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID))
{ {
sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this?
(ParcelMediaCommandEnum)commandToSend, (ParcelMediaCommandEnum)commandToSend,

View File

@ -124,7 +124,6 @@ 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 server_uri = string.Empty;
int gatekeeper_port = 0; int gatekeeper_port = 0;
IPEndPoint client_ipaddress = null; IPEndPoint client_ipaddress = null;
@ -175,7 +174,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
destination.RegionLocY = y; destination.RegionLocY = y;
destination.RegionName = regionname; destination.RegionName = regionname;
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,11 +86,12 @@ 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);
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); 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 " + uri);
XmlRpcResponse response = null; XmlRpcResponse response = null;
try try
{ {
response = request.Send(info.ServerURI, 10000); response = request.Send(uri, 10000);
} }
catch (Exception e) catch (Exception e)
{ {
@ -107,8 +108,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;
@ -116,20 +117,16 @@ 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: " + regionID); //m_log.Debug(">> HERE, uuid: " + uuid);
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"];
//m_log.Debug(">> HERE, imageURL: " + imageURL); if (hash["external_name"] != null)
}
if (hash["external_name"] != null) {
externalName = (string)hash["external_name"]; externalName = (string)hash["external_name"];
//m_log.Debug(">> HERE, externalName: " + externalName);
}
} }
} }
@ -191,15 +188,16 @@ 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);
//m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); 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 " + uri);
XmlRpcResponse response = null; XmlRpcResponse response = null;
try try
{ {
response = request.Send(gatekeeper.ServerURI, 10000); response = request.Send(uri, 10000);
} }
catch (Exception e) catch (Exception e)
{ {
//m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
return null; return null;
} }
@ -238,24 +236,21 @@ namespace OpenSim.Services.Connectors.Hypergrid
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, region_name: " + region.RegionName); //m_log.Debug(">> HERE, 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);
} }
// Successful return // Successful return

View File

@ -84,7 +84,8 @@ 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);
XmlRpcResponse response = request.Send(info.ServerURI, 10000); string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
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 = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/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

@ -147,6 +147,8 @@ 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 +170,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", regionInfo.ServerURI }, { "Address", httpAddress },
{ "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,7 +104,26 @@ namespace OpenSim.Services.Connectors.Simulation
return false; return false;
} }
string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; string uri = string.Empty;
// 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";
@ -258,7 +277,17 @@ 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 = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; string uri = string.Empty;
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";
@ -358,7 +387,8 @@ namespace OpenSim.Services.Connectors.Simulation
agent = null; agent = null;
if (ext == null) return false; if (ext == null) return false;
// 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 = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + 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";
@ -379,6 +409,7 @@ 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)
@ -399,6 +430,7 @@ 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;
} }
@ -407,6 +439,7 @@ namespace OpenSim.Services.Connectors.Simulation
return true; return true;
} }
//Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
return false; return false;
} }
@ -448,8 +481,18 @@ namespace OpenSim.Services.Connectors.Simulation
private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
{ {
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; string uri = string.Empty;
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";
@ -511,7 +554,7 @@ namespace OpenSim.Services.Connectors.Simulation
IPEndPoint ext = destination.ExternalEndPoint; IPEndPoint ext = destination.ExternalEndPoint;
if (ext == null) return false; if (ext == null) return false;
string uri string uri
= destination.ServerURI + ObjectPath() + sog.UUID + "/"; = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + 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), r.Data["serverURI"], String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(),
r.Data["owner_uuid"].ToString(), flags.ToString())); r.Data["owner_uuid"].ToString(), flags.ToString()));
} }
return; return;

View File

@ -127,7 +127,7 @@ 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> <RegionIP> <RegionPort> [<RegionServerURI] [<RemoteRegionName>] <cr>", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
"Link a hypergrid region", RunCommand); "Link a hypergrid region", 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> or <HostName>:<HttpPort> <cr>",
@ -198,7 +198,11 @@ 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)
// From the command line and the 2 above
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);
@ -213,11 +217,8 @@ namespace OpenSim.Services.GridService
// Big HACK for Simian Grid !!! // Big HACK for Simian Grid !!!
// We need to clean up all URLs used in OpenSim !!! // We need to clean up all URLs used in OpenSim !!!
if (externalHostName.Contains("/")) { if (externalHostName.Contains("/"))
regInfo.ServerURI = externalHostName; regInfo.ServerURI = externalHostName;
} else {
regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString();
}
try try
{ {
@ -508,16 +509,12 @@ 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 = region.ServerURI + "index.php?method=" + regionimage; imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage;
return true; return true;
} }

View File

@ -136,7 +136,6 @@ namespace OpenSim.Services.HypergridService
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.ExternalHostName +":"+ gatekeeper.HttpPort); gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
m_log.Debug("gatekeeper serveruri -> " + gatekeeper.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);
@ -146,12 +145,12 @@ namespace OpenSim.Services.HypergridService
region.RegionLocY = finalDestination.RegionLocY; region.RegionLocY = finalDestination.RegionLocY;
// Generate a new service session // Generate a new service session
agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random();
TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
bool success = false; bool success = false;
string myExternalIP = string.Empty; string myExternalIP = string.Empty;
string gridName = gatekeeper.ServerURI; string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort;
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
@ -160,7 +159,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.ServerURI, reason); agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason);
// restore the old travel info // restore the old travel info
lock (m_TravelingAgents) lock (m_TravelingAgents)
@ -211,7 +210,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 = region.ServerURI; travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
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,20 +115,8 @@ namespace OpenSim.Services.Interfaces
/// </summary> /// </summary>
public string ServerURI public string ServerURI
{ {
get { get { return m_serverURI; }
if ( m_serverURI != string.Empty ) { set { m_serverURI = value; }
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;
@ -176,7 +164,6 @@ 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

@ -339,7 +339,34 @@ namespace OpenSim.Services.LLLoginService
private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient)
{ {
SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); string capsSeedPath = String.Empty;
// 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()

View File

@ -1417,6 +1417,7 @@
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/> <Reference name="System.Core"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Xml.Linq"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
<Reference name="NDesk.Options" path="../../../bin/"/> <Reference name="NDesk.Options" path="../../../bin/"/>