Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
avinationmerge
Melanie 2013-03-28 02:29:07 +00:00
commit f548a41fb8
5 changed files with 100 additions and 62 deletions

View File

@ -97,6 +97,14 @@ namespace OpenSim.Region.ClientStack.Linden
+ " >= 1 - turns on outgoing event logging\n" + " >= 1 - turns on outgoing event logging\n"
+ " >= 2 - turns on poll notification", + " >= 2 - turns on poll notification",
HandleDebugEq); HandleDebugEq);
MainConsole.Instance.Commands.AddCommand(
"Debug",
false,
"show eq",
"show eq",
"Show contents of event queues for logged in avatars. Used for debugging.",
HandleShowEq);
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
@ -138,7 +146,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (!(args.Length == 3 && int.TryParse(args[2], out debugLevel))) if (!(args.Length == 3 && int.TryParse(args[2], out debugLevel)))
{ {
MainConsole.Instance.OutputFormat("Usage: debug eq [0|1]"); MainConsole.Instance.OutputFormat("Usage: debug eq [0|1|2]");
} }
else else
{ {
@ -148,6 +156,21 @@ namespace OpenSim.Region.ClientStack.Linden
} }
} }
protected void HandleShowEq(string module, string[] args)
{
MainConsole.Instance.OutputFormat("For scene {0}", m_scene.Name);
lock (queues)
{
foreach (KeyValuePair<UUID, Queue<OSD>> kvp in queues)
{
MainConsole.Instance.OutputFormat(
"For agent {0} there are {1} messages queued for send.",
kvp.Key, kvp.Value.Count);
}
}
}
/// <summary> /// <summary>
/// Always returns a valid queue /// Always returns a valid queue
/// </summary> /// </summary>

View File

@ -154,7 +154,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
void OnIncomingInstantMessage(GridInstantMessage im) void OnIncomingInstantMessage(GridInstantMessage im)
{ {
if (im.dialog == (byte)InstantMessageDialog.RequestTeleport) if (im.dialog == (byte)InstantMessageDialog.RequestTeleport
|| im.dialog == (byte)InstantMessageDialog.GodLikeRequestTeleport)
{ {
UUID sessionID = new UUID(im.imSessionID); UUID sessionID = new UUID(im.imSessionID);

View File

@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
(uint)presence.AbsolutePosition.Y, (uint)presence.AbsolutePosition.Y,
(uint)presence.AbsolutePosition.Z + 2); (uint)presence.AbsolutePosition.Z + 2);
m_log.DebugFormat("[LURE]: TP invite with message {0}", message); m_log.DebugFormat("TP invite with message {0}, type {1}", message, lureType);
GridInstantMessage m; GridInstantMessage m;

View File

@ -117,6 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
private IEventQueue m_eqModule; private IEventQueue m_eqModule;
private IRegionCombinerModule m_regionCombinerModule;
#region ISharedRegionModule #region ISharedRegionModule
@ -255,10 +256,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public virtual void RemoveRegion(Scene scene) public virtual void RemoveRegion(Scene scene)
{ {
StatsManager.DeregisterStat(m_interRegionTeleportAttempts); if (m_Enabled)
StatsManager.DeregisterStat(m_interRegionTeleportAborts); {
StatsManager.DeregisterStat(m_interRegionTeleportCancels); StatsManager.DeregisterStat(m_interRegionTeleportAttempts);
StatsManager.DeregisterStat(m_interRegionTeleportFailures); StatsManager.DeregisterStat(m_interRegionTeleportAborts);
StatsManager.DeregisterStat(m_interRegionTeleportCancels);
StatsManager.DeregisterStat(m_interRegionTeleportFailures);
}
} }
public virtual void RegionLoaded(Scene scene) public virtual void RegionLoaded(Scene scene)
@ -267,6 +271,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; return;
m_eqModule = Scene.RequestModuleInterface<IEventQueue>(); m_eqModule = Scene.RequestModuleInterface<IEventQueue>();
m_regionCombinerModule = Scene.RequestModuleInterface<IRegionCombinerModule>();
} }
#endregion #endregion
@ -377,8 +382,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Vector3 emergencyPos = new Vector3(128, 128, 128); Vector3 emergencyPos = new Vector3(128, 128, 128);
m_log.WarnFormat( m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2} in {3}. Substituting {4}",
position, sp.Name, sp.UUID, emergencyPos); position, sp.Name, sp.UUID, Scene.Name, emergencyPos);
position = emergencyPos; position = emergencyPos;
} }
@ -1010,41 +1015,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY)
{ {
Border[] northBorders = Scene.NorthBorders.ToArray(); if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
Border[] southBorders = Scene.SouthBorders.ToArray();
Border[] eastBorders = Scene.EastBorders.ToArray();
Border[] westBorders = Scene.WestBorders.ToArray();
// Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
// clear what should be done with a "far view" given that megaregions already extended the
// view to include everything in the megaregion
if (northBorders.Length > 1 || southBorders.Length > 1 || eastBorders.Length > 1 || westBorders.Length > 1)
{ {
Vector2 extent = Vector2.Zero; Vector2 swCorner, neCorner;
for (int i = 0; i < eastBorders.Length; i++) GetMegaregionViewRange(out swCorner, out neCorner);
{
extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
}
for (int i = 0; i < northBorders.Length; i++)
{
extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
}
// Loss of fraction on purpose
extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1;
extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1;
uint startX = oldRegionX - 1;
uint startY = oldRegionY - 1;
uint endX = oldRegionX + (uint)extent.X;
uint endY = oldRegionY + (uint)extent.Y;
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1},{2} to {3},{4} with new agent check for {5},{6}", "[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1} to {2} with new agent check for {3},{4}",
Scene.Name, startX, startY, endX, endY, newRegionX, newRegionY); Scene.Name, swCorner, neCorner, newRegionX, newRegionY);
return !(newRegionX >= startX && newRegionX <= endX && newRegionY >= startY && newRegionY <= endY); return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y);
} }
else else
{ {
@ -1328,7 +1308,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Scene initiatingScene) Scene initiatingScene)
{ {
Thread.Sleep(10000); Thread.Sleep(10000);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Auto-reteleporting {0} to correct megaregion location {1},{2},{3} from {4}",
agent.Name, regionX, regionY, position, initiatingScene.Name);
agent.Scene.RequestTeleportLocation(
agent.ControllingClient,
Utils.UIntsToLong(regionX * (uint)Constants.RegionSize, regionY * (uint)Constants.RegionSize),
position,
agent.Lookat,
(uint)Constants.TeleportFlags.ViaLocation);
/*
IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>();
if (im != null) if (im != null)
{ {
@ -1363,6 +1355,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}); });
} }
*/
} }
private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar) private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar)
@ -1870,6 +1863,37 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
reg.RegionName, sp.Name, sp.UUID, reason); reg.RegionName, sp.Name, sp.UUID, reason);
} }
/// <summary>
/// Gets the range considered in view of this megaregion (assuming this is a megaregion).
/// </summary>
/// <remarks>Expressed in 256m units</remarks>
/// <param name='swCorner'></param>
/// <param name='neCorner'></param>
private void GetMegaregionViewRange(out Vector2 swCorner, out Vector2 neCorner)
{
Border[] northBorders = Scene.NorthBorders.ToArray();
Border[] eastBorders = Scene.EastBorders.ToArray();
Vector2 extent = Vector2.Zero;
for (int i = 0; i < eastBorders.Length; i++)
{
extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
}
for (int i = 0; i < northBorders.Length; i++)
{
extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
}
// Loss of fraction on purpose
extent.X = ((int)extent.X / (int)Constants.RegionSize);
extent.Y = ((int)extent.Y / (int)Constants.RegionSize);
swCorner.X = Scene.RegionInfo.RegionLocX - 1;
swCorner.Y = Scene.RegionInfo.RegionLocY - 1;
neCorner.X = Scene.RegionInfo.RegionLocX + extent.X;
neCorner.Y = Scene.RegionInfo.RegionLocY + extent.Y;
}
/// <summary> /// <summary>
/// Return the list of regions that are considered to be neighbours to the given scene. /// Return the list of regions that are considered to be neighbours to the given scene.
/// </summary> /// </summary>
@ -1890,7 +1914,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
// clear what should be done with a "far view" given that megaregions already extended the // clear what should be done with a "far view" given that megaregions already extended the
// view to include everything in the megaregion // view to include everything in the megaregion
if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
{ {
int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance;
@ -1908,27 +1932,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
else else
{ {
Vector2 extent = Vector2.Zero; Vector2 swCorner, neCorner;
for (int i = 0; i < eastBorders.Length; i++) GetMegaregionViewRange(out swCorner, out neCorner);
{
extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
}
for (int i = 0; i < northBorders.Length; i++)
{
extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
}
// Loss of fraction on purpose List<GridRegion> neighbours
extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1; = pScene.GridService.GetRegionRange(
extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1; m_regionInfo.ScopeID,
(int)swCorner.X * (int)Constants.RegionSize,
(int)neCorner.X * (int)Constants.RegionSize,
(int)swCorner.Y * (int)Constants.RegionSize,
(int)neCorner.Y * (int)Constants.RegionSize);
int startX = (int)(pRegionLocX - 1) * (int)Constants.RegionSize;
int startY = (int)(pRegionLocY - 1) * (int)Constants.RegionSize;
int endX = ((int)pRegionLocX + (int)extent.X) * (int)Constants.RegionSize;
int endY = ((int)pRegionLocY + (int)extent.Y) * (int)Constants.RegionSize;
List<GridRegion> neighbours = pScene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
return neighbours; return neighbours;

View File

@ -199,7 +199,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override void RemoveRegion(Scene scene) public override void RemoveRegion(Scene scene)
{ {
base.AddRegion(scene); base.RemoveRegion(scene);
if (m_Enabled) if (m_Enabled)
scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);