Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
avinationmerge
Melanie 2012-05-19 13:34:44 +01:00
commit ebd9d2618b
15 changed files with 385 additions and 127 deletions

View File

@ -109,10 +109,11 @@ namespace OpenSim.Region.ClientStack.Linden
"Comms",
false,
"debug eq",
"debug eq [0|1]",
"Turn on event queue debugging",
"debug eq 1 will turn on event queue debugging. This will log all outgoing event queue messages to clients.\n"
+ "debug eq 0 will turn off event queue debugging.",
"debug eq [0|1|2]",
"Turn on event queue debugging"
+ "<= 0 - turns off all event queue logging"
+ ">= 1 - turns on outgoing event logging"
+ ">= 2 - turns on poll notification",
HandleDebugEq);
}
else
@ -235,19 +236,19 @@ namespace OpenSim.Region.ClientStack.Linden
// ClientClosed(client.AgentId);
// }
private void ClientClosed(UUID AgentID, Scene scene)
private void ClientClosed(UUID agentID, Scene scene)
{
// m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName);
// m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
int count = 0;
while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5)
while (queues.ContainsKey(agentID) && queues[agentID].Count > 0 && count++ < 5)
{
Thread.Sleep(1000);
}
lock (queues)
{
queues.Remove(AgentID);
queues.Remove(agentID);
}
List<UUID> removeitems = new List<UUID>();
@ -256,7 +257,7 @@ namespace OpenSim.Region.ClientStack.Linden
foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys)
{
// m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID);
if (ky == AgentID)
if (ky == agentID)
{
removeitems.Add(ky);
}
@ -267,7 +268,12 @@ namespace OpenSim.Region.ClientStack.Linden
UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky];
m_AvatarQueueUUIDMapping.Remove(ky);
MainServer.Instance.RemovePollServiceHTTPHandler("","/CAPS/EQG/" + eventQueueGetUuid.ToString() + "/");
string eqgPath = GenerateEqgCapPath(eventQueueGetUuid);
MainServer.Instance.RemovePollServiceHTTPHandler("", eqgPath);
// m_log.DebugFormat(
// "[EVENT QUEUE GET MODULE]: Removed EQG handler {0} for {1} in {2}",
// eqgPath, agentID, m_scene.RegionInfo.RegionName);
}
}
@ -281,7 +287,7 @@ namespace OpenSim.Region.ClientStack.Linden
{
searchval = m_QueueUUIDAvatarMapping[ky];
if (searchval == AgentID)
if (searchval == agentID)
{
removeitems.Add(ky);
}
@ -305,6 +311,15 @@ namespace OpenSim.Region.ClientStack.Linden
//}
}
/// <summary>
/// Generate an Event Queue Get handler path for the given eqg uuid.
/// </summary>
/// <param name='eqgUuid'></param>
private string GenerateEqgCapPath(UUID eqgUuid)
{
return string.Format("/CAPS/EQG/{0}/", eqgUuid);
}
public void OnRegisterCaps(UUID agentID, Caps caps)
{
// Register an event queue for the client
@ -316,8 +331,7 @@ namespace OpenSim.Region.ClientStack.Linden
// Let's instantiate a Queue for this agent right now
TryGetQueue(agentID);
string capsBase = "/CAPS/EQG/";
UUID EventQueueGetUUID = UUID.Zero;
UUID eventQueueGetUUID;
lock (m_AvatarQueueUUIDMapping)
{
@ -325,37 +339,35 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_AvatarQueueUUIDMapping.ContainsKey(agentID))
{
//m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!");
EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
}
else
{
EventQueueGetUUID = UUID.Random();
eventQueueGetUUID = UUID.Random();
//m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!");
}
}
lock (m_QueueUUIDAvatarMapping)
{
if (!m_QueueUUIDAvatarMapping.ContainsKey(EventQueueGetUUID))
m_QueueUUIDAvatarMapping.Add(EventQueueGetUUID, agentID);
if (!m_QueueUUIDAvatarMapping.ContainsKey(eventQueueGetUUID))
m_QueueUUIDAvatarMapping.Add(eventQueueGetUUID, agentID);
}
lock (m_AvatarQueueUUIDMapping)
{
if (!m_AvatarQueueUUIDMapping.ContainsKey(agentID))
m_AvatarQueueUUIDMapping.Add(agentID, EventQueueGetUUID);
m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID);
}
string eventQueueGetPath = GenerateEqgCapPath(eventQueueGetUUID);
// Register this as a caps handler
// FIXME: Confusingly, we need to register separate as a capability so that the client is told about
// EventQueueGet when it receive capability information, but then we replace the rest handler immediately
// afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but
// really it should be possible to directly register the poll handler as a capability.
caps.RegisterHandler(
"EventQueueGet",
new RestHTTPHandler(
"POST", capsBase + EventQueueGetUUID.ToString() + "/", null));
caps.RegisterHandler("EventQueueGet", new RestHTTPHandler("POST", eventQueueGetPath, null));
// delegate(Hashtable m_dhttpMethod)
// {
// return ProcessQueue(m_dhttpMethod, agentID, caps);
@ -364,9 +376,13 @@ namespace OpenSim.Region.ClientStack.Linden
// This will persist this beyond the expiry of the caps handlers
// TODO: Add EventQueueGet name/description for diagnostics
MainServer.Instance.AddPollServiceHTTPHandler(
capsBase + EventQueueGetUUID.ToString() + "/",
eventQueueGetPath,
new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
// m_log.DebugFormat(
// "[EVENT QUEUE GET MODULE]: Registered EQG handler {0} for {1} in {2}",
// eventQueueGetPath, agentID, m_scene.RegionInfo.RegionName);
Random rnd = new Random(Environment.TickCount);
lock (m_ids)
{
@ -388,9 +404,25 @@ namespace OpenSim.Region.ClientStack.Linden
return false;
}
/// <summary>
/// Logs a debug line for an outbound event queue message if appropriate.
/// </summary>
/// <param name='element'>Element containing message</param>
private void LogOutboundDebugMessage(OSD element, UUID agentId)
{
if (element is OSDMap)
{
OSDMap ev = (OSDMap)element;
m_log.DebugFormat(
"Eq OUT {0,-30} to {1,-20} {2,-20}",
ev["message"], m_scene.GetScenePresence(agentId).Name, m_scene.RegionInfo.RegionName);
}
}
public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request)
{
// m_log.DebugFormat("[EVENT QUEUE GET MODULE]: Invoked GetEvents() for {0}", pAgentId);
if (DebugLevel >= 2)
m_log.DebugFormat("POLLED FOR EQ MESSAGES BY {0} in {1}", pAgentId, m_scene.RegionInfo.RegionName);
Queue<OSD> queue = TryGetQueue(pAgentId);
OSD element;
@ -414,13 +446,8 @@ namespace OpenSim.Region.ClientStack.Linden
}
else
{
if (DebugLevel > 0 && element is OSDMap)
{
OSDMap ev = (OSDMap)element;
m_log.DebugFormat(
"[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
ev["message"], m_scene.GetScenePresence(pAgentId).Name);
}
if (DebugLevel > 0)
LogOutboundDebugMessage(element, pAgentId);
array.Add(element);
@ -430,13 +457,8 @@ namespace OpenSim.Region.ClientStack.Linden
{
element = queue.Dequeue();
if (DebugLevel > 0 && element is OSDMap)
{
OSDMap ev = (OSDMap)element;
m_log.DebugFormat(
"[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
ev["message"], m_scene.GetScenePresence(pAgentId).Name);
}
if (DebugLevel > 0)
LogOutboundDebugMessage(element, pAgentId);
array.Add(element);
thisID++;

View File

@ -67,7 +67,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// Determine whether this archive will save assets. Default is true.
/// </summary>
public bool SaveAssets { get; set; }
protected ArchiverModule m_module;
protected Scene m_scene;
protected Stream m_saveStream;
protected Guid m_requestId;
@ -75,13 +76,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <summary>
/// Constructor
/// </summary>
/// <param name="scene"></param>
/// <param name="module">Calling module</param>
/// <param name="savePath">The path to which to save data.</param>
/// <param name="requestId">The id associated with this request</param>
/// <exception cref="System.IO.IOException">
/// If there was a problem opening a stream for the file specified by the savePath
/// </exception>
public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) : this(scene, requestId)
public ArchiveWriteRequestPreparation(ArchiverModule module, string savePath, Guid requestId) : this(module, requestId)
{
try
{
@ -99,17 +100,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <summary>
/// Constructor.
/// </summary>
/// <param name="scene"></param>
/// <param name="module">Calling module</param>
/// <param name="saveStream">The stream to which to save data.</param>
/// <param name="requestId">The id associated with this request</param>
public ArchiveWriteRequestPreparation(Scene scene, Stream saveStream, Guid requestId) : this(scene, requestId)
public ArchiveWriteRequestPreparation(ArchiverModule module, Stream saveStream, Guid requestId) : this(module, requestId)
{
m_saveStream = saveStream;
}
protected ArchiveWriteRequestPreparation(Scene scene, Guid requestId)
protected ArchiveWriteRequestPreparation(ArchiverModule module, Guid requestId)
{
m_scene = scene;
m_module = module;
// FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix
// this.
if (m_module != null)
m_scene = m_module.Scene;
m_requestId = requestId;
SaveAssets = true;
@ -364,32 +371,56 @@ namespace OpenSim.Region.CoreModules.World.Archiver
//if (majorVersion == 1)
//{
// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
//}
//}
String s;
StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw);
xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument();
xtw.WriteStartElement("archive");
xtw.WriteAttributeString("major_version", majorVersion.ToString());
xtw.WriteAttributeString("minor_version", minorVersion.ToString());
using (StringWriter sw = new StringWriter())
{
using (XmlTextWriter xtw = new XmlTextWriter(sw))
{
xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument();
xtw.WriteStartElement("archive");
xtw.WriteAttributeString("major_version", majorVersion.ToString());
xtw.WriteAttributeString("minor_version", minorVersion.ToString());
xtw.WriteStartElement("creation_info");
DateTime now = DateTime.UtcNow;
TimeSpan t = now - new DateTime(1970, 1, 1);
xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString());
xtw.WriteElementString("id", UUID.Random().ToString());
xtw.WriteEndElement();
xtw.WriteElementString("assets_included", SaveAssets.ToString());
bool isMegaregion;
xtw.WriteStartElement("creation_info");
DateTime now = DateTime.UtcNow;
TimeSpan t = now - new DateTime(1970, 1, 1);
xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString());
xtw.WriteElementString("id", UUID.Random().ToString());
xtw.WriteEndElement();
// FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix
// this, possibly by doing control file creation somewhere else.
if (m_module != null && m_module.RegionCombinerModule != null)
{
IRegionCombinerModule mod = m_module.RegionCombinerModule;
isMegaregion = mod.IsRootForMegaregion(m_scene.RegionInfo.RegionID);
}
else
{
isMegaregion = false;
}
xtw.WriteElementString("is_megaregion", isMegaregion.ToString());
xtw.WriteEndElement();
xtw.Flush();
xtw.Close();
}
xtw.WriteElementString("assets_included", SaveAssets.ToString());
s = sw.ToString();
}
xtw.WriteEndElement();
xtw.Flush();
xtw.Close();
String s = sw.ToString();
sw.Close();
// Console.WriteLine(
// "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s);
return s;
}

View File

@ -45,7 +45,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
public Scene Scene { get; private set; }
public IRegionCombinerModule RegionCombinerModule { get; private set; }
/// <value>
/// The file used to load and save an opensimulator archive if no filename has been specified
@ -70,13 +71,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public void AddRegion(Scene scene)
{
m_scene = scene;
m_scene.RegisterModuleInterface<IRegionArchiverModule>(this);
Scene = scene;
Scene.RegisterModuleInterface<IRegionArchiverModule>(this);
//m_log.DebugFormat("[ARCHIVER]: Enabled for region {0}", scene.RegionInfo.RegionName);
}
public void RegionLoaded(Scene scene)
{
RegionCombinerModule = scene.RequestModuleInterface<IRegionCombinerModule>();
}
public void RemoveRegion(Scene scene)
@ -165,9 +167,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public void ArchiveRegion(string savePath, Guid requestId, Dictionary<string, object> options)
{
m_log.InfoFormat(
"[ARCHIVER]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath);
"[ARCHIVER]: Writing archive for region {0} to {1}", Scene.RegionInfo.RegionName, savePath);
new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion(options);
new ArchiveWriteRequestPreparation(this, savePath, requestId).ArchiveRegion(options);
}
public void ArchiveRegion(Stream saveStream)
@ -182,7 +184,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public void ArchiveRegion(Stream saveStream, Guid requestId, Dictionary<string, object> options)
{
new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion(options);
new ArchiveWriteRequestPreparation(this, saveStream, requestId).ArchiveRegion(options);
}
public void DearchiveRegion(string loadPath)
@ -193,9 +195,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId)
{
m_log.InfoFormat(
"[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath);
"[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
new ArchiveReadRequest(m_scene, loadPath, merge, skipAssets, requestId).DearchiveRegion();
new ArchiveReadRequest(Scene, loadPath, merge, skipAssets, requestId).DearchiveRegion();
}
public void DearchiveRegion(Stream loadStream)
@ -205,7 +207,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId)
{
new ArchiveReadRequest(m_scene, loadStream, merge, skipAssets, requestId).DearchiveRegion();
new ArchiveReadRequest(Scene, loadStream, merge, skipAssets, requestId).DearchiveRegion();
}
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenSim.Region.Framework.Scenes;
using System.IO;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IRegionCombinerModule
{
/// <summary>
/// Does the given id belong to the root region of a megaregion?
/// </summary>
bool IsRootForMegaregion(UUID sceneId);
}
}

View File

@ -591,13 +591,18 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGraph.Entities; }
}
// can be closest/random/sequence
private string m_SpawnPointRouting = "closest";
// used in sequence see: SpawnPoint()
private int m_SpawnPoint;
// can be closest/random/sequence
public string SpawnPointRouting
{
get { return m_SpawnPointRouting; }
get; private set;
}
// allow landmarks to pass
public bool TelehubAllowLandmarks
{
get; private set;
}
#endregion Properties
@ -737,7 +742,8 @@ namespace OpenSim.Region.Framework.Scenes
m_maxPhys = RegionInfo.PhysPrimMax;
}
m_SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
// Here, if clamping is requested in either global or
// local config, it will be used
@ -2794,7 +2800,8 @@ namespace OpenSim.Region.Framework.Scenes
if (sp == null)
{
m_log.DebugFormat(
"[SCENE]: Adding new child scene presence {0} to scene {1} at pos {2}", client.Name, RegionInfo.RegionName, client.StartPos);
"[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}",
client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos);
m_clientManager.Add(client);
SubscribeToClientEvents(client);
@ -4098,6 +4105,7 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
// TODO: This check should probably be in QueryAccess().
ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2);
if (nearestParcel == null)
{
@ -4108,14 +4116,8 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
int num = m_sceneGraph.GetNumberOfScenePresences();
if (num >= RegionInfo.RegionSettings.AgentLimit)
{
if (!Permissions.IsAdministrator(cAgentData.AgentID))
return false;
}
// We have to wait until the viewer contacts this region after receiving EAC.
// That calls AddNewClient, which finally creates the ScenePresence
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
@ -4159,14 +4161,28 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
/// <summary>
/// Poll until the requested ScenePresence appears or we timeout.
/// </summary>
/// <returns>The scene presence is found, else null.</returns>
/// <param name='agentID'></param>
protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
{
int ntimes = 10;
ScenePresence childAgentUpdate = null;
while ((childAgentUpdate = GetScenePresence(agentID)) == null && (ntimes-- > 0))
ScenePresence sp = null;
while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0))
Thread.Sleep(1000);
return childAgentUpdate;
if (sp == null)
m_log.WarnFormat(
"[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout",
agentID, RegionInfo.RegionName);
// else
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Found presence {0} {1} {2} in {3} after {4} waits",
// sp.Name, sp.UUID, sp.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 10 - ntimes);
return sp;
}
public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent)
@ -5493,13 +5509,22 @@ Environment.Exit(1);
return true;
}
int num = m_sceneGraph.GetNumberOfScenePresences();
// FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
// However, the long term fix is to make sure root agent count is always accurate.
m_sceneGraph.RecalculateStats();
int num = m_sceneGraph.GetRootAgentCount();
if (num >= RegionInfo.RegionSettings.AgentLimit)
{
if (!Permissions.IsAdministrator(agentID))
{
reason = "The region is full";
m_log.DebugFormat(
"[SCENE]: Denying presence with id {0} entry into {1} since region is at agent limit of {2}",
agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit);
return false;
}
}

View File

@ -860,11 +860,6 @@ namespace OpenSim.Region.Framework.Scenes
return m_scenePresenceArray;
}
public int GetNumberOfScenePresences()
{
return m_scenePresenceArray.Count;
}
/// <summary>
/// Request a scene presence by UUID. Fast, indexed lookup.
/// </summary>

View File

@ -1299,6 +1299,12 @@ namespace OpenSim.Region.Framework.Scenes
Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
m_callbackURI = null;
}
// else
// {
// m_log.DebugFormat(
// "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}",
// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
// }
ValidateAndSendAppearanceAndAgentData();
@ -2691,7 +2697,7 @@ namespace OpenSim.Region.Framework.Scenes
// If we are using the the cached appearance then send it out to everyone
if (cachedappearance)
{
m_log.DebugFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
m_log.DebugFormat("[SCENE PRESENCE]: baked textures are in the cache for {0}", Name);
// If the avatars baked textures are all in the cache, then we have a
// complete appearance... send it out, if not, then we'll send it when
@ -3153,7 +3159,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ChildAgentDataUpdate(AgentData cAgentData)
{
//m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName);
// m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName);
if (!IsChildAgent)
return;
@ -3297,6 +3303,9 @@ namespace OpenSim.Region.Framework.Scenes
m_originRegionID = cAgent.RegionID;
m_callbackURI = cAgent.CallbackURI;
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
// Name, m_scene.RegionInfo.RegionName, m_callbackURI);
m_pos = cAgent.Position;
m_velocity = cAgent.Velocity;
@ -4120,7 +4129,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
(TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
(m_teleportFlags & TeleportFlags.ViaLandmark) != 0 ||
(m_scene.TelehubAllowLandmarks == true ? false : ((m_teleportFlags & TeleportFlags.ViaLandmark) != 0 )) ||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
{

View File

@ -1261,14 +1261,20 @@ namespace OpenSim.Region.Physics.OdePlugin
{
m_requestedUpdateFrequency = ms;
m_eventsubscription = ms;
CollisionEventsThisFrame.Clear();
// Don't clear collision event reporting here. This is called directly from scene code and so can lead
// to a race condition with the simulate loop
_parent_scene.AddCollisionEventReporting(this);
}
public override void UnSubscribeEvents()
{
CollisionEventsThisFrame.Clear();
_parent_scene.RemoveCollisionEventReporting(this);
// Don't clear collision event reporting here. This is called directly from scene code and so can lead
// to a race condition with the simulate loop
m_requestedUpdateFrequency = 0;
m_eventsubscription = 0;
}

View File

@ -43,9 +43,8 @@ using Mono.Addins;
[assembly: AddinDependency("OpenSim", "0.5")]
namespace OpenSim.Region.RegionCombinerModule
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class RegionCombinerModule : ISharedRegionModule
public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -59,8 +58,22 @@ namespace OpenSim.Region.RegionCombinerModule
get { return null; }
}
/// <summary>
/// This holds the root regions for the megaregions.
/// </summary>
/// <remarks>
/// Usually there is only ever one megaregion (and hence only one entry here).
/// </remarks>
private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
/// <summary>
/// Is this module enabled?
/// </summary>
private bool enabledYN = false;
/// <summary>
/// The scenes that comprise the megaregion.
/// </summary>
private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
public void Initialise(IConfigSource source)
@ -69,9 +82,11 @@ namespace OpenSim.Region.RegionCombinerModule
enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
if (enabledYN)
{
MainConsole.Instance.Commands.AddCommand(
"RegionCombinerModule", false, "fix-phantoms", "fix-phantoms",
"Fixes phantom objects after an import to megaregions", FixPhantoms);
}
}
public void Close()
@ -80,6 +95,8 @@ namespace OpenSim.Region.RegionCombinerModule
public void AddRegion(Scene scene)
{
if (enabledYN)
scene.RegisterModuleInterface<IRegionCombinerModule>(this);
}
public void RemoveRegion(Scene scene)
@ -89,7 +106,95 @@ namespace OpenSim.Region.RegionCombinerModule
public void RegionLoaded(Scene scene)
{
if (enabledYN)
{
RegionLoadedDoWork(scene);
scene.EventManager.OnNewPresence += NewPresence;
}
}
public bool IsRootForMegaregion(UUID sceneId)
{
lock (m_regions)
return m_regions.ContainsKey(sceneId);
}
private void NewPresence(ScenePresence presence)
{
if (presence.IsChildAgent)
{
byte[] throttleData;
try
{
throttleData = presence.ControllingClient.GetThrottlesPacked(1);
}
catch (NotImplementedException)
{
return;
}
if (throttleData == null)
return;
if (throttleData.Length == 0)
return;
if (throttleData.Length != 28)
return;
byte[] adjData;
int pos = 0;
if (!BitConverter.IsLittleEndian)
{
byte[] newData = new byte[7 * 4];
Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4);
for (int i = 0; i < 7; i++)
Array.Reverse(newData, i * 4, 4);
adjData = newData;
}
else
{
adjData = throttleData;
}
// 0.125f converts from bits to bytes
int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
// State is a subcategory of task that we allocate a percentage to
//int total = resend + land + wind + cloud + task + texture + asset;
byte[] data = new byte[7 * 4];
int ii = 0;
Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4;
Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4;
Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4;
Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4;
Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4;
Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4;
Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4);
try
{
presence.ControllingClient.SetChildAgentThrottle(data);
}
catch (NotImplementedException)
{
return;
}
}
}
private void RegionLoadedDoWork(Scene scene)
@ -348,9 +453,9 @@ namespace OpenSim.Region.RegionCombinerModule
if (!connectedYN)
{
DoWorkForRootRegion(regionConnections, scene);
}
}
// Set up infinite borders around the entire AABB of the combined ConnectedRegions
AdjustLargeRegionBounds();
}
@ -369,9 +474,10 @@ namespace OpenSim.Region.RegionCombinerModule
conn.UpdateExtents(extents);
m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
m_log.DebugFormat(
"[REGION COMBINER MODULE]: Scene {0} to the west of Scene {1}, Offset: {2}, Extents: {3}",
conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
scene.BordersLocked = true;
conn.RegionScene.BordersLocked = true;
@ -447,9 +553,10 @@ namespace OpenSim.Region.RegionCombinerModule
ConnectedRegion.RegionScene = scene;
conn.ConnectedRegions.Add(ConnectedRegion);
m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
m_log.DebugFormat(
"[REGION COMBINER MODULE]: Scene: {0} to the northeast of Scene {1}, Offset: {2}, Extents: {3}",
conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
@ -502,9 +609,10 @@ namespace OpenSim.Region.RegionCombinerModule
conn.ConnectedRegions.Add(ConnectedRegion);
m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
m_log.DebugFormat(
"[REGION COMBINER MODULE]: Scene: {0} to the NorthEast of Scene {1}, Offset: {2}, Extents: {3}",
conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
@ -581,6 +689,8 @@ namespace OpenSim.Region.RegionCombinerModule
private void DoWorkForRootRegion(RegionConnections regionConnections, Scene scene)
{
m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName);
RegionData rdata = new RegionData();
rdata.Offset = Vector3.Zero;
rdata.RegionId = scene.RegionInfo.originRegionID;

View File

@ -10373,7 +10373,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.TaskInventory.LockItemsForRead(false);
// ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
ScenePresence presence = World.GetScenePresence(agentID);
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
if (presence != null)
{
LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z);
@ -10397,7 +10397,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.TaskInventory.LockItemsForRead(false);
// ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
ScenePresence presence = World.GetScenePresence(agentID);
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
if (presence != null)
{
return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W);

View File

@ -307,14 +307,20 @@ namespace OpenSim.Services.InventoryService
if (check != null)
return false;
if (folder.Type == (short)AssetType.Folder || folder.Type == (short)AssetType.Unknown ||
GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null)
if (folder.Type == (short)AssetType.Folder
|| folder.Type == (short)AssetType.Unknown
|| folder.Type == (short)AssetType.OutfitFolder
|| GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null)
{
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
return m_Database.StoreFolder(xFolder);
}
else
m_log.DebugFormat("[XINVENTORY]: Folder {0} of type {1} already exists", folder.Name, folder.Type);
{
m_log.WarnFormat(
"[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}",
folder.Type, folder.Name, folder.ParentID, folder.Owner);
}
return false;
}

View File

@ -29,6 +29,7 @@ using System;
using System.Reflection;
using System.Threading;
using log4net;
using log4net.Config;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Console;
@ -52,6 +53,8 @@ namespace pCampBot
[STAThread]
public static void Main(string[] args)
{
XmlConfigurator.Configure();
IConfig config = ParseConfig(args);
if (config.Get("help") != null || config.Get("loginuri") == null)
{

View File

@ -249,6 +249,11 @@
;; "sequence" will place the avatar on the next sequential SpawnPoint
; SpawnPointRouting = closest
;# {TelehubAllowLandmark} {} {Allow users with landmarks to override telehub routing} {true false} false
;; TelehubAllowLandmark allows users with landmarks to override telehub routing and land at the landmark coordinates when set to true
;; default is false
; TelehubAllowLandmark = false
[Estates]
; If these values are commented out then the user will be asked for estate details when required (this is the normal case).
; If these values are uncommented then they will be used to create a default estate as necessary.

View File

@ -601,13 +601,12 @@
Cap_ViewerStartAuction = ""
Cap_ViewerStats = ""
; The various fetch inventory caps are supported by OpenSim, but may
; lead to poor sim performance if served by the simulators,
; so they are currently disabled by default.
; Capabilities for fetching inventory over HTTP rather than UDP
; FetchInventoryDescendents2 and FetchInventory2 are the ones used in the latest Linden Lab viewers (from some point in the v2 series and above)
; It appears that Linden Lab viewer 3.3.1 onwards will not work properly if FetchInventoryDescendents2 and FetchInventory2 are not enabled
Cap_WebFetchInventoryDescendents = ""
Cap_FetchInventoryDescendents2 = ""
Cap_FetchInventory2 = ""
Cap_FetchInventoryDescendents2 = "localhost"
Cap_FetchInventory2 = "localhost"
[Chat]

View File

@ -8,7 +8,7 @@
<log4net>
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
<conversionPattern value="%date{HH:mm:ss.fff} - %message%newline" />
</layout>
</appender>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">