Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.csavinationmerge
commit
c6d75cda97
|
@ -42,6 +42,22 @@ namespace OpenSim.Data.Null
|
||||||
|
|
||||||
// private string m_connectionString;
|
// private string m_connectionString;
|
||||||
|
|
||||||
|
private Dictionary<uint, EstateSettings> m_knownEstates = new Dictionary<uint, EstateSettings>();
|
||||||
|
private EstateSettings m_estate = null;
|
||||||
|
|
||||||
|
private EstateSettings GetEstate()
|
||||||
|
{
|
||||||
|
if (m_estate == null)
|
||||||
|
{
|
||||||
|
// This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase).
|
||||||
|
// The estate info is pretty empty so don't try banning anyone.
|
||||||
|
m_estate = new EstateSettings();
|
||||||
|
m_estate.EstateID = 1;
|
||||||
|
m_estate.OnSave += StoreEstateSettings;
|
||||||
|
}
|
||||||
|
return m_estate;
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual Assembly Assembly
|
protected virtual Assembly Assembly
|
||||||
{
|
{
|
||||||
get { return GetType().Assembly; }
|
get { return GetType().Assembly; }
|
||||||
|
@ -68,21 +84,18 @@ namespace OpenSim.Data.Null
|
||||||
|
|
||||||
public EstateSettings LoadEstateSettings(UUID regionID, bool create)
|
public EstateSettings LoadEstateSettings(UUID regionID, bool create)
|
||||||
{
|
{
|
||||||
// This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase).
|
return GetEstate();
|
||||||
// The estate info is pretty empty so don't try banning anyone.
|
|
||||||
EstateSettings oneEstate = new EstateSettings();
|
|
||||||
oneEstate.EstateID = 1;
|
|
||||||
return oneEstate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreEstateSettings(EstateSettings es)
|
public void StoreEstateSettings(EstateSettings es)
|
||||||
{
|
{
|
||||||
|
m_estate = es;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EstateSettings LoadEstateSettings(int estateID)
|
public EstateSettings LoadEstateSettings(int estateID)
|
||||||
{
|
{
|
||||||
return new EstateSettings();
|
return GetEstate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EstateSettings CreateNewEstate()
|
public EstateSettings CreateNewEstate()
|
||||||
|
@ -93,13 +106,14 @@ namespace OpenSim.Data.Null
|
||||||
public List<EstateSettings> LoadEstateSettingsAll()
|
public List<EstateSettings> LoadEstateSettingsAll()
|
||||||
{
|
{
|
||||||
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
|
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
|
||||||
allEstateSettings.Add(new EstateSettings());
|
allEstateSettings.Add(GetEstate());
|
||||||
return allEstateSettings;
|
return allEstateSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<int> GetEstatesAll()
|
public List<int> GetEstatesAll()
|
||||||
{
|
{
|
||||||
List<int> result = new List<int>();
|
List<int> result = new List<int>();
|
||||||
|
result.Add((int)GetEstate().EstateID);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,5 +224,26 @@ public class CounterStat : Stat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CounterStat is a basic stat plus histograms
|
||||||
|
public override OSDMap ToOSDMap()
|
||||||
|
{
|
||||||
|
// Get the foundational instance
|
||||||
|
OSDMap map = base.ToOSDMap();
|
||||||
|
|
||||||
|
map["StatType"] = "CounterStat";
|
||||||
|
|
||||||
|
// If there are any histograms, add a new field that is an array of histograms as OSDMaps
|
||||||
|
if (m_histograms.Count > 0)
|
||||||
|
{
|
||||||
|
OSDArray histos = new OSDArray();
|
||||||
|
foreach (EventHistogram histo in m_histograms.Values)
|
||||||
|
{
|
||||||
|
histos.Add(histo.GetHistogramAsOSDMap());
|
||||||
|
}
|
||||||
|
map.Add("Histograms", histos);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,6 +242,7 @@ namespace OpenSim.Framework.Monitoring
|
||||||
ret.Add("Description", OSD.FromString(Description));
|
ret.Add("Description", OSD.FromString(Description));
|
||||||
ret.Add("UnitName", OSD.FromString(UnitName));
|
ret.Add("UnitName", OSD.FromString(UnitName));
|
||||||
ret.Add("Value", OSD.FromReal(Value));
|
ret.Add("Value", OSD.FromReal(Value));
|
||||||
|
ret.Add("StatType", "Stat"); // used by overloading classes to denote type of stat
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Monitoring
|
namespace OpenSim.Framework.Monitoring
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -168,6 +170,70 @@ namespace OpenSim.Framework.Monitoring
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Creates an OSDMap of the format:
|
||||||
|
// { categoryName: {
|
||||||
|
// containerName: {
|
||||||
|
// statName: {
|
||||||
|
// "Name": name,
|
||||||
|
// "ShortName": shortName,
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// statName: {
|
||||||
|
// "Name": name,
|
||||||
|
// "ShortName": shortName,
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// containerName: {
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// categoryName: {
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
// The passed in parameters will filter the categories, containers and stats returned. If any of the
|
||||||
|
// parameters are either EmptyOrNull or the AllSubCommand value, all of that type will be returned.
|
||||||
|
// Case matters.
|
||||||
|
public static OSDMap GetStatsAsOSDMap(string pCategoryName, string pContainerName, string pStatName)
|
||||||
|
{
|
||||||
|
OSDMap map = new OSDMap();
|
||||||
|
|
||||||
|
foreach (string catName in RegisteredStats.Keys)
|
||||||
|
{
|
||||||
|
// Do this category if null spec, "all" subcommand or category name matches passed parameter.
|
||||||
|
// Skip category if none of the above.
|
||||||
|
if (!(String.IsNullOrEmpty(pCategoryName) || pCategoryName == AllSubCommand || pCategoryName == catName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
OSDMap contMap = new OSDMap();
|
||||||
|
foreach (string contName in RegisteredStats[catName].Keys)
|
||||||
|
{
|
||||||
|
if (!(string.IsNullOrEmpty(pContainerName) || pContainerName == AllSubCommand || pContainerName == contName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
OSDMap statMap = new OSDMap();
|
||||||
|
|
||||||
|
SortedDictionary<string, Stat> theStats = RegisteredStats[catName][contName];
|
||||||
|
foreach (string statName in theStats.Keys)
|
||||||
|
{
|
||||||
|
if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
statMap.Add(statName, theStats[statName].ToOSDMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
contMap.Add(contName, statMap);
|
||||||
|
}
|
||||||
|
map.Add(catName, contMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// Start collecting statistics related to assets.
|
// /// Start collecting statistics related to assets.
|
||||||
// /// Should only be called once.
|
// /// Should only be called once.
|
||||||
|
|
|
@ -64,11 +64,18 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private bool m_persistBakedTextures;
|
private bool m_persistBakedTextures;
|
||||||
|
private string m_URL;
|
||||||
|
|
||||||
private IBakedTextureModule m_BakedTextureModule;
|
private IBakedTextureModule m_BakedTextureModule;
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
|
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||||
|
if (config == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
|
||||||
|
|
||||||
IConfig appearanceConfig = source.Configs["Appearance"];
|
IConfig appearanceConfig = source.Configs["Appearance"];
|
||||||
if (appearanceConfig != null)
|
if (appearanceConfig != null)
|
||||||
m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
|
m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
|
||||||
|
@ -280,23 +287,28 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
public void RegisterCaps(UUID agentID, Caps caps)
|
public void RegisterCaps(UUID agentID, Caps caps)
|
||||||
{
|
{
|
||||||
UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
|
UUID capID = UUID.Random();
|
||||||
caps, m_scene.AssetService, m_persistBakedTextures);
|
|
||||||
|
|
||||||
|
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||||
|
if (m_URL == "localhost")
|
||||||
|
{
|
||||||
|
UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
|
||||||
|
caps, m_scene.AssetService, m_persistBakedTextures);
|
||||||
|
|
||||||
|
caps.RegisterHandler(
|
||||||
caps.RegisterHandler(
|
|
||||||
"UploadBakedTexture",
|
|
||||||
new RestStreamHandler(
|
|
||||||
"POST",
|
|
||||||
"/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath,
|
|
||||||
avatarhandler.UploadBakedTexture,
|
|
||||||
"UploadBakedTexture",
|
"UploadBakedTexture",
|
||||||
agentID.ToString()));
|
new RestStreamHandler(
|
||||||
|
"POST",
|
||||||
|
"/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath,
|
||||||
|
avatarhandler.UploadBakedTexture,
|
||||||
|
"UploadBakedTexture",
|
||||||
|
agentID.ToString()));
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caps.RegisterHandler("UploadBakedTexture", m_URL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4703,10 +4703,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
|
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe for physics collision events if needed for scripts and sounds
|
/// <summary>
|
||||||
|
/// Subscribe for physics collision events if needed for scripts and sounds
|
||||||
|
/// </summary>
|
||||||
public void SubscribeForCollisionEvents()
|
public void SubscribeForCollisionEvents()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||||
|
@ -4724,20 +4728,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
(CollisionSound != UUID.Zero)
|
(CollisionSound != UUID.Zero)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!PhysActor.SubscribedEvents())
|
if (!pa.SubscribedEvents())
|
||||||
{
|
{
|
||||||
// If not already subscribed for event, set up for a collision event.
|
// If not already subscribed for event, set up for a collision event.
|
||||||
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
pa.OnCollisionUpdate += PhysicsCollision;
|
||||||
PhysActor.SubscribeEvents(1000);
|
pa.SubscribeEvents(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// There is no need to be subscribed to collisions so, if subscribed, remove subscription
|
// There is no need to be subscribed to collisions so, if subscribed, remove subscription
|
||||||
if (PhysActor.SubscribedEvents())
|
if (pa.SubscribedEvents())
|
||||||
{
|
{
|
||||||
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
pa.OnCollisionUpdate -= PhysicsCollision;
|
||||||
PhysActor.UnSubscribeEvents();
|
pa.UnSubscribeEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
|
if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
|
||||||
{
|
{
|
||||||
m_coopTermination = true;
|
m_coopTermination = true;
|
||||||
m_coopSleepHandle = new AutoResetEvent(false);
|
m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1221,4 +1221,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
Suspended = false;
|
Suspended = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Xengine event wait handle.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This class exists becase XEngineScriptBase gets a reference to this wait handle. We need to make sure that
|
||||||
|
/// when scripts are running in different AppDomains the lease does not expire.
|
||||||
|
/// FIXME: Like LSL_Api, etc., this effectively leaks memory since the GC will never collect it. To avoid this,
|
||||||
|
/// proper remoting sponsorship needs to be implemented across the board.
|
||||||
|
/// </remarks>
|
||||||
|
public class XEngineEventWaitHandle : EventWaitHandle
|
||||||
|
{
|
||||||
|
public XEngineEventWaitHandle(bool initialState, EventResetMode mode) : base(initialState, mode) {}
|
||||||
|
|
||||||
|
public override Object InitializeLifetimeService()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -82,7 +82,16 @@ namespace OpenSim.Tests.Clients.AssetsClient
|
||||||
m_log.InfoFormat("[ASSET CLIENT]: [{0}] requested asset {1}", i, uuid);
|
m_log.InfoFormat("[ASSET CLIENT]: [{0}] requested asset {1}", i, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.Sleep(20 * 1000);
|
for (int i = 0; i < 500; i++)
|
||||||
|
{
|
||||||
|
var x = i;
|
||||||
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
|
{
|
||||||
|
Dummy(x);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(30 * 1000);
|
||||||
m_log.InfoFormat("[ASSET CLIENT]: Received responses {0}", m_NReceived);
|
m_log.InfoFormat("[ASSET CLIENT]: Received responses {0}", m_NReceived);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +101,16 @@ namespace OpenSim.Tests.Clients.AssetsClient
|
||||||
m_MaxThreadID = Thread.CurrentThread.ManagedThreadId;
|
m_MaxThreadID = Thread.CurrentThread.ManagedThreadId;
|
||||||
int max1, max2;
|
int max1, max2;
|
||||||
ThreadPool.GetAvailableThreads(out max1, out max2);
|
ThreadPool.GetAvailableThreads(out max1, out max2);
|
||||||
m_log.InfoFormat("[ASSET CLIENT]: Received asset {0} ({1}) ({2}-{3})", id, m_MaxThreadID, max1, max2);
|
m_log.InfoFormat("[ASSET CLIENT]: Received asset {0} ({1}) ({2}-{3}) {4}", id, m_MaxThreadID, max1, max2, DateTime.Now.ToString("hh:mm:ss"));
|
||||||
m_NReceived++;
|
m_NReceived++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void Dummy(int i)
|
||||||
|
{
|
||||||
|
int max1, max2;
|
||||||
|
ThreadPool.GetAvailableThreads(out max1, out max2);
|
||||||
|
m_log.InfoFormat("[ASSET CLIENT]: ({0}) Hello! {1} - {2} {3}", i, max1, max2, DateTime.Now.ToString("hh:mm:ss"));
|
||||||
|
Thread.Sleep(2000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue