Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2011-05-14 21:09:52 +01:00
commit 37a7b87862
12 changed files with 109 additions and 89 deletions

View File

@ -35,8 +35,8 @@ namespace OpenSim.Framework
public interface ILandObject public interface ILandObject
{ {
int GetParcelMaxPrimCount(ILandObject thisObject); int GetParcelMaxPrimCount();
int GetSimulatorMaxPrimCount(ILandObject thisObject); int GetSimulatorMaxPrimCount();
int GetPrimsFree(); int GetPrimsFree();
LandData LandData { get; set; } LandData LandData { get; set; }

View File

@ -251,11 +251,11 @@ namespace OpenSim.Framework
// This just dumps a warning for any operation that takes more than 100 ms // This just dumps a warning for any operation that takes more than 100 ms
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
if (tickdiff > LongCallTime) if (tickdiff > LongCallTime)
m_log.InfoFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", m_log.DebugFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing",
reqnum,url,method,tickdiff,tickdata); reqnum,url,method,tickdiff,tickdata);
} }
m_log.WarnFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage); m_log.DebugFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
return ErrorResponseMap(errorMessage); return ErrorResponseMap(errorMessage);
} }
@ -986,8 +986,11 @@ namespace OpenSim.Framework
try try
{ {
using (WebResponse resp = request.GetResponse()) using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse())
{ {
if (resp.StatusCode == HttpStatusCode.NotFound)
return deserial;
if (resp.ContentLength != 0) if (resp.ContentLength != 0)
{ {
Stream respStream = resp.GetResponseStream(); Stream respStream = resp.GetResponseStream();

View File

@ -367,7 +367,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
if (!m_merge) if (!m_merge)
m_scene.LandChannel.Clear(false); {
bool setupDefaultParcel = (landData.Count == 0);
m_scene.LandChannel.Clear(setupDefaultParcel);
}
m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);

View File

@ -313,6 +313,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels");
// Temporary // Temporary
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
} }

View File

@ -437,8 +437,12 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
/// <summary>
/// Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of distance.
/// </summary>
/// <param name="avatar"></param>
public void EventManagerOnClientMovement(ScenePresence avatar) public void EventManagerOnClientMovement(ScenePresence avatar)
//Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of distance. //
{ {
ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (over != null) if (over != null)
@ -451,7 +455,6 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID, public void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID,
int landLocalID, IClientAPI remote_client) int landLocalID, IClientAPI remote_client)
{ {
@ -587,13 +590,13 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
m_landList.Clear(); m_landList.Clear();
}
ResetSimLandObjects(); ResetSimLandObjects();
if (setupDefaultParcel) if (setupDefaultParcel)
CreateDefaultParcel(); CreateDefaultParcel();
} }
}
private void performFinalLandJoin(ILandObject master, ILandObject slave) private void performFinalLandJoin(ILandObject master, ILandObject slave)
{ {
@ -1323,10 +1326,13 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
public void EventManagerOnNoLandDataFromStorage() public void EventManagerOnNoLandDataFromStorage()
{
lock (m_landList)
{ {
ResetSimLandObjects(); ResetSimLandObjects();
CreateDefaultParcel(); CreateDefaultParcel();
} }
}
#endregion #endregion

View File

@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public int GetPrimsFree() public int GetPrimsFree()
{ {
m_scene.EventManager.TriggerParcelPrimCountUpdate(); m_scene.EventManager.TriggerParcelPrimCountUpdate();
int free = GetSimulatorMaxPrimCount(this) - m_landData.SimwidePrims; int free = GetSimulatorMaxPrimCount() - m_landData.SimwidePrims;
return free; return free;
} }
@ -181,11 +181,11 @@ namespace OpenSim.Region.CoreModules.World.Land
overrideSimulatorMaxPrimCount = overrideDel; overrideSimulatorMaxPrimCount = overrideDel;
} }
public int GetParcelMaxPrimCount(ILandObject thisObject) public int GetParcelMaxPrimCount()
{ {
if (overrideParcelMaxPrimCount != null) if (overrideParcelMaxPrimCount != null)
{ {
return overrideParcelMaxPrimCount(thisObject); return overrideParcelMaxPrimCount(this);
} }
else else
{ {
@ -197,11 +197,12 @@ namespace OpenSim.Region.CoreModules.World.Land
return parcelMax; return parcelMax;
} }
} }
public int GetSimulatorMaxPrimCount(ILandObject thisObject)
public int GetSimulatorMaxPrimCount()
{ {
if (overrideSimulatorMaxPrimCount != null) if (overrideSimulatorMaxPrimCount != null)
{ {
return overrideSimulatorMaxPrimCount(thisObject); return overrideSimulatorMaxPrimCount(this);
} }
else else
{ {
@ -244,8 +245,8 @@ namespace OpenSim.Region.CoreModules.World.Land
remote_client.SendLandProperties(seq_id, remote_client.SendLandProperties(seq_id,
snap_selection, request_result, this, snap_selection, request_result, this,
(float)m_scene.RegionInfo.RegionSettings.ObjectBonus, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
GetParcelMaxPrimCount(this), GetParcelMaxPrimCount(),
GetSimulatorMaxPrimCount(this), regionFlags); GetSimulatorMaxPrimCount(), regionFlags);
} }
public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)

View File

@ -82,14 +82,14 @@ namespace OpenSim.Region.CoreModules.World.Region
false, "region restart bluebox", false, "region restart bluebox",
"region restart bluebox <message> <delta seconds>+", "region restart bluebox <message> <delta seconds>+",
"Schedule a region restart", "Schedule a region restart",
"Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.",
HandleRegionRestart); HandleRegionRestart);
MainConsole.Instance.Commands.AddCommand("RestartModule", MainConsole.Instance.Commands.AddCommand("RestartModule",
false, "region restart notice", false, "region restart notice",
"region restart notice <message> <delta seconds>+", "region restart notice <message> <delta seconds>+",
"Schedule a region restart", "Schedule a region restart",
"Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.",
HandleRegionRestart); HandleRegionRestart);
MainConsole.Instance.Commands.AddCommand("RestartModule", MainConsole.Instance.Commands.AddCommand("RestartModule",

View File

@ -927,9 +927,9 @@ namespace OpenSim.Region.Framework.Scenes
uint callbackID, string description, string name, uint callbackID, string description, string name,
sbyte invType, sbyte type, UUID olditemID) sbyte invType, sbyte type, UUID olditemID)
{ {
m_log.DebugFormat( // m_log.DebugFormat(
"[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", // "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}",
remoteClient.Name, name, folderID, olditemID); // remoteClient.Name, name, folderID, olditemID);
if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return; return;
@ -937,20 +937,25 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence presence; ScenePresence presence;
if (TryGetScenePresence(remoteClient.AgentId, out presence)) if (TryGetScenePresence(remoteClient.AgentId, out presence))
{ {
bool linkAlreadyExists = false; // Disabled the check for duplicate links.
List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); //
foreach (InventoryItemBase item in existingItems) // When outfits are being adjusted, the viewer rapidly sends delete link messages followed by
if (item.AssetID == olditemID) // create links. However, since these are handled asynchronously, the deletes do not complete before
linkAlreadyExists = true; // the creates are handled. Therefore, we cannot enforce a duplicate link check.
// InventoryItemBase existingLink = null;
if (linkAlreadyExists) // List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID);
{ // foreach (InventoryItemBase item in existingItems)
m_log.WarnFormat( // if (item.AssetID == olditemID)
"[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", // existingLink = item;
remoteClient.Name, name, folderID, olditemID); //
// if (existingLink != null)
return; // {
} // m_log.WarnFormat(
// "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link named {4} with id {5} already exists",
// remoteClient.Name, name, folderID, olditemID, existingLink.Name, existingLink.ID);
//
// return;
// }
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = olditemID; asset.FullID = olditemID;
@ -978,7 +983,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="itemID"></param> /// <param name="itemID"></param>
private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs) private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs)
{ {
//m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId); // m_log.DebugFormat(
// "[AGENT INVENTORY]: Removing inventory items {0} for {1}",
// string.Join(",", itemIDs.ConvertAll<string>(uuid => uuid.ToString()).ToArray()),
// remoteClient.Name);
InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); InventoryService.DeleteItems(remoteClient.AgentId, itemIDs);
} }

View File

@ -76,22 +76,24 @@ namespace OpenSim.Region.OptionalModules
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if(!m_enabled) if (!m_enabled)
{ {
return; return;
} }
scene.Permissions.OnRezObject += CanRezObject; scene.Permissions.OnRezObject += CanRezObject;
scene.Permissions.OnObjectEntry += CanObjectEnter; scene.Permissions.OnObjectEntry += CanObjectEnter;
scene.Permissions.OnDuplicateObject += CanDuplicateObject; scene.Permissions.OnDuplicateObject += CanDuplicateObject;
m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName); m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName);
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
if(m_enabled) if (m_enabled)
{ {
return; return;
} }
scene.Permissions.OnRezObject -= CanRezObject; scene.Permissions.OnRezObject -= CanRezObject;
scene.Permissions.OnObjectEntry -= CanObjectEnter; scene.Permissions.OnObjectEntry -= CanObjectEnter;
scene.Permissions.OnDuplicateObject -= CanDuplicateObject; scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
@ -104,13 +106,11 @@ namespace OpenSim.Region.OptionalModules
private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
{ {
// This may be a little long winded and can probably be optomized ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
int usedPrims = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).PrimCounts.Total; int usedPrims = lo.PrimCounts.Total;
LandData landData = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).LandData; int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) *
(float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus);
if(objectCount + usedPrims > simulatorCapacity) if (objectCount + usedPrims > simulatorCapacity)
{ {
m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full");
return false; return false;
@ -118,7 +118,7 @@ namespace OpenSim.Region.OptionalModules
return true; return true;
} }
//OnMoveObject
private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene)
{ {
SceneObjectPart obj = scene.GetSceneObjectPart(objectID); SceneObjectPart obj = scene.GetSceneObjectPart(objectID);
@ -127,10 +127,8 @@ namespace OpenSim.Region.OptionalModules
ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
int usedPrims=newParcel.PrimCounts.Total; int usedPrims = newParcel.PrimCounts.Total;
LandData landData = newParcel.LandData; int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) *
(float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus);
// The prim hasn't crossed a region boundry so we don't need to worry // The prim hasn't crossed a region boundry so we don't need to worry
// about prim counts here // about prim counts here
@ -138,35 +136,38 @@ namespace OpenSim.Region.OptionalModules
{ {
return true; return true;
} }
// Prim counts are determined by the location of the root prim. if we're // Prim counts are determined by the location of the root prim. if we're
// moving a child prim, just let it pass // moving a child prim, just let it pass
if(!obj.IsRoot) if(!obj.IsRoot)
{ {
return true; return true;
} }
// Add Special Case here for temporary prims
// TODO: Add Special Case here for temporary prims
if(objectCount + usedPrims > simulatorCapacity) if(objectCount + usedPrims > simulatorCapacity)
{ {
m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full");
return false; return false;
} }
return true; return true;
} }
//OnDuplicateObject //OnDuplicateObject
private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition) private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition)
{ {
// This may be a little long winded and can probably be optomized ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
int usedPrims = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).PrimCounts.Total; int usedPrims = lo.PrimCounts.Total;
LandData landData = scene.LandChannel.GetLandObject(objectPosition.X,objectPosition.Y).LandData; int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) *
(float)scene.RegionInfo.ObjectCapacity * (float)scene.RegionInfo.RegionSettings.ObjectBonus);
if(objectCount + usedPrims > simulatorCapacity) if(objectCount + usedPrims > simulatorCapacity)
{ {
m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full");
return false; return false;
} }
return true; return true;
} }
} }

View File

@ -10587,31 +10587,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide) public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Alondria: This currently just is utilizing the normal grid's 0.22 prims/m2 calculation
// Which probably will be irrelevent in OpenSim....
LandData land = World.GetLandData((float)pos.x, (float)pos.y);
float bonusfactor = (float)World.RegionInfo.RegionSettings.ObjectBonus; ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
if (land == null) if (lo == null)
{
return 0; return 0;
}
if (sim_wide != 0) if (sim_wide != 0)
{ return lo.GetSimulatorMaxPrimCount();
decimal v = land.SimwideArea * (decimal)(0.22) * (decimal)bonusfactor;
return (int)v;
}
else else
{ return lo.GetParcelMaxPrimCount();
decimal v = land.Area * (decimal)(0.22) * (decimal)bonusfactor;
return (int)v;
}
} }
public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param)

View File

@ -30,6 +30,7 @@ using System.Collections;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Security;
using System.Text; using System.Text;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
@ -143,7 +144,7 @@ namespace OpenSim.Server.Handlers.Grid
sb.Append("<gridinfo>\n"); sb.Append("<gridinfo>\n");
foreach (string k in _info.Keys) foreach (string k in _info.Keys)
{ {
sb.AppendFormat("<{0}>{1}</{0}>\n", k, _info[k]); sb.AppendFormat("<{0}>{1}</{0}>\n", k, SecurityElement.Escape(_info[k].ToString()));
} }
sb.Append("</gridinfo>\n"); sb.Append("</gridinfo>\n");

View File

@ -40,10 +40,12 @@ namespace OpenSim.Tests.Common.Mock
public class TestLandChannel : ILandChannel public class TestLandChannel : ILandChannel
{ {
private Scene m_scene; private Scene m_scene;
private List<ILandObject> m_parcels;
public TestLandChannel(Scene scene) public TestLandChannel(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_parcels = new List<ILandObject>();
} }
public List<ILandObject> ParcelsNearPoint(Vector3 position) public List<ILandObject> ParcelsNearPoint(Vector3 position)
@ -53,12 +55,19 @@ namespace OpenSim.Tests.Common.Mock
public List<ILandObject> AllParcels() public List<ILandObject> AllParcels()
{ {
return new List<ILandObject>(); return m_parcels;
} }
public void Clear(bool setupDefaultParcel) public void Clear(bool setupDefaultParcel)
{ {
// Intentionally blank since we don't save any parcel data in the test channel m_parcels.Clear();
if (setupDefaultParcel)
{
ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
obj.LandData.Name = "Your Parcel";
m_parcels.Add(obj);
}
} }
protected ILandObject GetNoLand() protected ILandObject GetNoLand()