varregion: Add region size to teleport event messages (EnableSimulator,

CorssRegion, TeleportFinishEvent).
Have Simian grid service return the region size.
Many teleport related debug log messages. Can be removed when teleport
works (like that's ever going to happen).

Conflicts:

	OpenSim/Framework/RegionInfo.cs
master-beforevarregion
Robert Adams 2014-01-03 07:41:06 -08:00
parent 004ecee314
commit 7e32313a49
9 changed files with 104 additions and 39 deletions

View File

@ -238,6 +238,8 @@ namespace OpenSim.Framework
{
RegionLocX = legacyRegionLocX;
RegionLocY = legacyRegionLocY;
RegionSizeX = Constants.RegionSize;
RegionSizeY = Constants.RegionSize;
m_internalEndPoint = internalEndPoint;
m_externalHostName = externalUri;
m_serverURI = string.Empty;

View File

@ -711,34 +711,46 @@ namespace OpenSim.Region.ClientStack.Linden
Enqueue(item, avatarID);
}
public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID)
public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
{
OSD item = EventQueueHelper.EnableSimulator(handle, endPoint);
m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>",
"[EVENT QUEUE GET MODULE]", handle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
}
public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath)
public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath,
ulong regionHandle, int regionSizeX, int regionSizeY)
{
OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath);
m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>",
"[EVENT QUEUE GET MODULE]", regionHandle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
}
public virtual void TeleportFinishEvent(ulong regionHandle, byte simAccess,
IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL,
UUID avatarID)
UUID avatarID, int regionSizeX, int regionSizeY)
{
m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>",
"[EVENT QUEUE GET MODULE]", regionHandle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint,
locationID, flags, capsURL, avatarID);
locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
}
public virtual void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID avatarID, UUID sessionID)
string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
{
m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
"[EVENT QUEUE GET MODULE]", handle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint,
capsURL, avatarID, sessionID);
capsURL, avatarID, sessionID, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
}

View File

@ -70,13 +70,15 @@ namespace OpenSim.Region.ClientStack.Linden
return llsdEvent;
}
public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint)
public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint, int regionSizeX, int regionSizeY)
{
OSDMap llsdSimInfo = new OSDMap(3);
OSDMap llsdSimInfo = new OSDMap(5);
llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port));
llsdSimInfo.Add("RegionSizeX", new OSDInteger(regionSizeX));
llsdSimInfo.Add("RegionSizeY", new OSDInteger(regionSizeY));
OSDArray arr = new OSDArray(1);
arr.Add(llsdSimInfo);
@ -104,7 +106,8 @@ namespace OpenSim.Region.ClientStack.Linden
public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID agentID, UUID sessionID)
string capsURL, UUID agentID, UUID sessionID,
int regionSizeX, int regionSizeY)
{
OSDArray lookAtArr = new OSDArray(3);
lookAtArr.Add(OSD.FromReal(lookAt.X));
@ -130,11 +133,13 @@ namespace OpenSim.Region.ClientStack.Linden
OSDArray agentDataArr = new OSDArray(1);
agentDataArr.Add(agentDataMap);
OSDMap regionDataMap = new OSDMap(4);
OSDMap regionDataMap = new OSDMap(6);
regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle)));
regionDataMap.Add("SeedCapability", OSD.FromString(capsURL));
regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port));
regionDataMap.Add("RegionSizeX", new OSDInteger(regionSizeX));
regionDataMap.Add("RegionSizeY", new OSDInteger(regionSizeY));
OSDArray regionDataArr = new OSDArray(1);
regionDataArr.Add(regionDataMap);
@ -148,8 +153,9 @@ namespace OpenSim.Region.ClientStack.Linden
}
public static OSD TeleportFinishEvent(
ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL, UUID agentID)
ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL, UUID agentID,
int regionSizeX, int regionSizeY)
{
OSDMap info = new OSDMap();
info.Add("AgentID", OSD.FromUUID(agentID));
@ -160,6 +166,8 @@ namespace OpenSim.Region.ClientStack.Linden
info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
info.Add("RegionSizeX", new OSDInteger(regionSizeX));
info.Add("RegionSizeY", new OSDInteger(regionSizeY));
OSDArray infoArr = new OSDArray();
infoArr.Add(info);
@ -187,12 +195,18 @@ namespace OpenSim.Region.ClientStack.Linden
return BuildEvent("ScriptRunningReply", body);
}
public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap)
public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap,
ulong regionHandle, int regionSizeX, int regionSizeY)
{
OSDMap body = new OSDMap(3);
body.Add("agent-id", new OSDUUID(agentID));
body.Add("sim-ip-and-port", new OSDString(simIpAndPort));
body.Add("seed-capability", new OSDString(seedcap));
OSDMap body = new OSDMap(6)
{
{"agent-id", new OSDUUID(agentID)},
{"sim-ip-and-port", new OSDString(simIpAndPort)},
{"seed-capability", new OSDString(seedcap)},
{"region-handle", OSD.FromULong(regionHandle)},
{"region-size-x", OSD.FromInteger(regionSizeX)},
{"region-size-y", OSD.FromInteger(regionSizeY)}
};
return BuildEvent("EstablishAgentCommunication", body);
}

View File

@ -825,7 +825,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// The EnableSimulator message makes the client establish a connection with the destination
// simulator by sending the initial UseCircuitCode UDP packet to the destination containing the
// correct circuit code.
m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID);
m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
m_log.DebugFormat("{0} Sent EnableSimulator. regName={1}, size=<{2},{3}>", LogHeader,
finalDestination.RegionName, finalDestination.RegionSizeX, finalDestination.RegionSizeY);
// XXX: Is this wait necessary? We will always end up waiting on UpdateAgent for the destination
// simulator to confirm that it has established communication with the viewer.
@ -835,7 +838,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// unnecessary - teleport will succeed and SEED caps will be requested without it (though possibly
// only on TeleportFinish). This is untested for region teleport between different simulators
// though this probably also works.
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, finalDestination.RegionHandle,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
}
else
{
@ -921,7 +925,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// OK, send TPFinish to the client, so that it starts the process of contacting the destination region
if (m_eqModule != null)
{
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID);
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
}
else
{
@ -1074,7 +1079,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// New protocol: send TP Finish directly, without prior ES or EAC. That's what happens in the Linden grid
if (m_eqModule != null)
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID);
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
else
sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4,
teleportFlags, capsPath);
@ -1717,11 +1723,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (m_eqModule != null)
{
m_eqModule.CrossRegion(
neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId);
neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */,
neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId,
neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
}
else
{
m_log.ErrorFormat("{0} Using old CrossRegion packet. Varregion will not work!!", LogHeader);
agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos + agent.Velocity, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath);
}
@ -2087,12 +2096,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
#endregion
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbour region {2} @ {3} " +
"and EstablishAgentCommunication with seed cap {4}",
scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
"and EstablishAgentCommunication with seed cap {8}", LogHeader,
scene.RegionInfo.RegionName, sp.Name,
reg.RegionName, reg.RegionLocX, reg.RegionLocY, reg.RegionSizeX, reg.RegionSizeY , capsPath);
m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID, reg.RegionSizeX, reg.RegionSizeY);
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, reg.RegionHandle, reg.RegionSizeX, reg.RegionSizeY);
}
else
{

View File

@ -39,16 +39,17 @@ namespace OpenSim.Region.Framework.Interfaces
// These are required to decouple Scenes from EventQueueHelper
void DisableSimulator(ulong handle, UUID avatarID);
void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID);
void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY);
void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint,
string capsPath);
string capsPath, ulong regionHandle, int regionSizeX, int regionSizeY);
void TeleportFinishEvent(ulong regionHandle, byte simAccess,
IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL,
UUID agentID);
UUID agentID, int regionSizeX, int regionSizeY);
void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID avatarID, UUID sessionID);
string capsURL, UUID avatarID, UUID sessionID,
int regionSizeX, int regionSizeY);
void ChatterboxInvitation(UUID sessionID, string sessionName,
UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog,
uint timeStamp, bool offline, int parentEstateID, Vector3 position,

View File

@ -1953,6 +1953,11 @@ namespace OpenSim.Region.Framework.Scenes
GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
m_log.DebugFormat("{0} RegisterRegionWithGrid. name={1},id={2},loc=<{3},{4}>,size=<{5},{6}>",
LogHeader, m_regionName,
RegionInfo.RegionID,
RegionInfo.RegionLocX, RegionInfo.RegionLocY,
RegionInfo.RegionSizeX, RegionInfo.RegionSizeY);
if (error != String.Empty)
throw new Exception(error);
}

View File

@ -443,9 +443,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
region.RegionName = response["Name"].AsString();
Vector3d minPosition = response["MinPosition"].AsVector3d();
Vector3d maxPosition = response["MaxPosition"].AsVector3d();
region.RegionLocX = (int)minPosition.X;
region.RegionLocY = (int)minPosition.Y;
region.RegionSizeX = (int)maxPosition.X - (int)minPosition.X;
region.RegionSizeY = (int)maxPosition.Y - (int)minPosition.Y;
if ( ! extraData["HyperGrid"] ) {
Uri httpAddress = response["Address"].AsUri();
region.ExternalHostName = httpAddress.Host;

View File

@ -29,9 +29,13 @@ using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using OpenSim.Framework;
using OpenMetaverse;
using log4net;
namespace OpenSim.Services.Interfaces
{
public interface IGridService
@ -119,6 +123,9 @@ namespace OpenSim.Services.Interfaces
public class GridRegion
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[GRID REGION]";
/// <summary>
/// The port by which http communication occurs with the region
/// </summary>
@ -422,9 +429,13 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("sizeX"))
RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]);
else
RegionSizeX = (int)Constants.RegionSize;
if (kvp.ContainsKey("sizeY"))
RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]);
else
RegionSizeX = (int)Constants.RegionSize;
if (kvp.ContainsKey("regionName"))
RegionName = (string)kvp["regionName"];
@ -473,6 +484,9 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("Token"))
Token = kvp["Token"].ToString();
m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>",
LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY);
}
}
}

View File

@ -114,22 +114,25 @@ namespace OpenSim.Tests.Common
AddEvent(avatarID, "DisableSimulator", handle);
}
public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID)
public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
{
AddEvent(avatarID, "EnableSimulator", handle);
}
public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath)
public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath,
ulong regionHandle, int regionSizeX, int regionSizeY)
{
AddEvent(avatarID, "EstablishAgentCommunication", endPoint, capsPath);
}
public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID)
public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL, UUID agentID, int regionSizeX, int regionSizeY)
{
AddEvent(agentID, "TeleportFinishEvent", regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL);
}
public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL, UUID avatarID, UUID sessionID)
public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
{
AddEvent(avatarID, "CrossRegion", handle, pos, lookAt, newRegionExternalEndPoint, capsURL, sessionID);
}