Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-03-18 20:09:04 +00:00
commit 4c2a51b1b5
46 changed files with 3429 additions and 3243 deletions

View File

@ -227,8 +227,12 @@ namespace OpenSim.Framework
{ {
get get
{ {
//m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); //m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length);
return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); }
catch { }
m_log.Warn("[SHAPE]: Failed to decode texture, length=" + ((m_textureEntry != null) ? m_textureEntry.Length : 0));
return new Primitive.TextureEntry(null);
} }
set { m_textureEntry = value.GetBytes(); } set { m_textureEntry = value.GetBytes(); }

View File

@ -42,6 +42,7 @@ using Nwc.XmlRpc;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using CoolHTTPListener = HttpServer.HttpListener; using CoolHTTPListener = HttpServer.HttpListener;
using HttpListener=System.Net.HttpListener; using HttpListener=System.Net.HttpListener;
using LogPrio=HttpServer.LogPrio;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
{ {
@ -341,7 +342,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// the request can be passed through to the other handlers. This is a low // the request can be passed through to the other handlers. This is a low
// probability event; if a request is matched it is normally expected to be // probability event; if a request is matched it is normally expected to be
// handled // handled
//m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl); // m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
IHttpAgentHandler agentHandler; IHttpAgentHandler agentHandler;
@ -496,7 +497,8 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
case null: case null:
case "text/html": case "text/html":
//m_log.Info("[Debug BASE HTTP SERVER]: found a text/html content type"); // m_log.DebugFormat(
// "[BASE HTTP SERVER]: Found a text/html content type for request {0}", request.RawUrl);
HandleHTTPRequest(request, response); HandleHTTPRequest(request, response);
return; return;
@ -524,10 +526,11 @@ namespace OpenSim.Framework.Servers.HttpServer
HandleLLSDRequests(request, response); HandleLLSDRequests(request, response);
return; return;
} }
//m_log.Info("[Debug BASE HTTP SERVER]: Checking for HTTP Handler");
// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
if (DoWeHaveAHTTPHandler(request.RawUrl)) if (DoWeHaveAHTTPHandler(request.RawUrl))
{ {
//m_log.Info("[Debug BASE HTTP SERVER]: found HTTP Handler"); // m_log.DebugFormat("[BASE HTTP SERVER]: Found HTTP Handler for request {0}", request.RawUrl);
HandleHTTPRequest(request, response); HandleHTTPRequest(request, response);
return; return;
} }
@ -943,7 +946,7 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
catch (IOException e) catch (IOException e)
{ {
m_log.DebugFormat("[BASE HTTP SERVER]: LLSD IOException {0}.", e); m_log.WarnFormat("[BASE HTTP SERVER]: LLSD IOException {0}.", e);
} }
catch (SocketException e) catch (SocketException e)
{ {
@ -1219,6 +1222,10 @@ namespace OpenSim.Framework.Servers.HttpServer
public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
{ {
// m_log.DebugFormat(
// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}",
// request.RawUrl, request.HttpMethod);
switch (request.HttpMethod) switch (request.HttpMethod)
{ {
case "OPTIONS": case "OPTIONS":
@ -1233,6 +1240,8 @@ namespace OpenSim.Framework.Servers.HttpServer
private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response)
{ {
// m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl);
// This is a test. There's a workable alternative.. as this way sucks. // This is a test. There's a workable alternative.. as this way sucks.
// We'd like to put this into a text file parhaps that's easily editable. // We'd like to put this into a text file parhaps that's easily editable.
// //
@ -1273,13 +1282,15 @@ namespace OpenSim.Framework.Servers.HttpServer
foreach (string queryname in querystringkeys) foreach (string queryname in querystringkeys)
{ {
// m_log.DebugFormat(
// "[BASE HTTP SERVER]: Got query paremeter {0}={1}", queryname, request.QueryString[queryname]);
keysvals.Add(queryname, request.QueryString[queryname]); keysvals.Add(queryname, request.QueryString[queryname]);
requestVars.Add(queryname, keysvals[queryname]); requestVars.Add(queryname, keysvals[queryname]);
} }
foreach (string headername in rHeaders) foreach (string headername in rHeaders)
{ {
//m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); // m_log.Debug("[BASE HTTP SERVER]: " + headername + "=" + request.Headers[headername]);
headervals[headername] = request.Headers[headername]; headervals[headername] = request.Headers[headername];
} }
@ -1291,12 +1302,13 @@ namespace OpenSim.Framework.Servers.HttpServer
keysvals.Add("headers", headervals); keysvals.Add("headers", headervals);
keysvals.Add("querystringkeys", querystringkeys); keysvals.Add("querystringkeys", querystringkeys);
keysvals.Add("requestvars", requestVars); keysvals.Add("requestvars", requestVars);
// keysvals.Add("form", request.Form);
if (keysvals.Contains("method")) if (keysvals.Contains("method"))
{ {
//m_log.Warn("[HTTP]: Contains Method"); // m_log.Debug("[BASE HTTP SERVER]: Contains Method");
string method = (string) keysvals["method"]; string method = (string) keysvals["method"];
//m_log.Warn("[HTTP]: " + requestBody); // m_log.Debug("[BASE HTTP SERVER]: " + requestBody);
GenericHTTPMethod requestprocessor; GenericHTTPMethod requestprocessor;
bool foundHandler = TryGetHTTPHandler(method, out requestprocessor); bool foundHandler = TryGetHTTPHandler(method, out requestprocessor);
if (foundHandler) if (foundHandler)
@ -1308,13 +1320,12 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
else else
{ {
//m_log.Warn("[HTTP]: Handler Not Found"); // m_log.Warn("[BASE HTTP SERVER]: Handler Not Found");
SendHTML404(response, host); SendHTML404(response, host);
} }
} }
else else
{ {
GenericHTTPMethod requestprocessor; GenericHTTPMethod requestprocessor;
bool foundHandler = TryGetHTTPHandlerPathBased(request.RawUrl, out requestprocessor); bool foundHandler = TryGetHTTPHandlerPathBased(request.RawUrl, out requestprocessor);
if (foundHandler) if (foundHandler)
@ -1326,7 +1337,7 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
else else
{ {
//m_log.Warn("[HTTP]: Handler Not Found"); // m_log.Warn("[BASE HTTP SERVER]: Handler Not Found2");
SendHTML404(response, host); SendHTML404(response, host);
} }
} }
@ -1374,8 +1385,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length)
{ {
// You have to specifically register for '/' and to get it, you must specificaly request it // You have to specifically register for '/' and to get it, you must specifically request it
//
if (pattern == "/" && searchquery == "/" || pattern != "/") if (pattern == "/" && searchquery == "/" || pattern != "/")
bestMatch = pattern; bestMatch = pattern;
} }
@ -1814,30 +1824,36 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <summary> /// <summary>
/// Relays HttpServer log messages to our own logging mechanism. /// Relays HttpServer log messages to our own logging mechanism.
/// </summary> /// </summary>
/// There is also a UseTraceLogs line in this file that can be uncommented for more detailed log information /// To use this you must uncomment the switch section
///
/// You may also be able to get additional trace information from HttpServer if you uncomment the UseTraceLogs
/// property in StartHttp() for the HttpListener
public class HttpServerLogWriter : ILogWriter public class HttpServerLogWriter : ILogWriter
{ {
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public void Write(object source, LogPrio priority, string message) public void Write(object source, LogPrio priority, string message)
{ {
/* /*
switch (priority) switch (priority)
{ {
case HttpServer.LogPrio.Debug: case LogPrio.Trace:
m_log.DebugFormat("[{0}]: {1}", source.ToString(), message); m_log.DebugFormat("[{0}]: {1}", source, message);
break; break;
case HttpServer.LogPrio.Error: case LogPrio.Debug:
m_log.ErrorFormat("[{0}]: {1}", source.ToString(), message); m_log.DebugFormat("[{0}]: {1}", source, message);
break; break;
case HttpServer.LogPrio.Info: case LogPrio.Error:
m_log.InfoFormat("[{0}]: {1}", source.ToString(), message); m_log.ErrorFormat("[{0}]: {1}", source, message);
break; break;
case HttpServer.LogPrio.Warning: case LogPrio.Info:
m_log.WarnFormat("[{0}]: {1}", source.ToString(), message); m_log.InfoFormat("[{0}]: {1}", source, message);
break; break;
case HttpServer.LogPrio.Fatal: case LogPrio.Warning:
m_log.ErrorFormat("[{0}]: FATAL! - {1}", source.ToString(), message); m_log.WarnFormat("[{0}]: {1}", source, message);
break;
case LogPrio.Fatal:
m_log.ErrorFormat("[{0}]: FATAL! - {1}", source, message);
break; break;
default: default:
break; break;

View File

@ -127,6 +127,11 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
private Hashtable _query; private Hashtable _query;
/// <value>
/// POST request values, if applicable
/// </value>
// public Hashtable Form { get; private set; }
public string RawUrl public string RawUrl
{ {
get { return _request.Uri.AbsolutePath; } get { return _request.Uri.AbsolutePath; }
@ -228,6 +233,13 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
_log.ErrorFormat("[OSHttpRequest]: Error parsing querystring"); _log.ErrorFormat("[OSHttpRequest]: Error parsing querystring");
} }
// Form = new Hashtable();
// foreach (HttpInputItem item in req.Form)
// {
// _log.DebugFormat("[OSHttpRequest]: Got form item {0}={1}", item.Name, item.Value);
// Form.Add(item.Name, item.Value);
// }
} }
public override string ToString() public override string ToString()

View File

@ -897,7 +897,7 @@ namespace OpenSim
{ {
connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n", connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n",
scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode); scene.RegionInfo.RegionName, client.Name, client.AgentId, client.RemoteEndPoint, client.CircuitCode);
}, false }
); );
} }
); );

View File

@ -1020,7 +1020,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Handle outgoing packets, resends, acknowledgements, and pings for each // Handle outgoing packets, resends, acknowledgements, and pings for each
// client. m_packetSent will be set to true if a packet is sent // client. m_packetSent will be set to true if a packet is sent
m_scene.ForEachClient(clientPacketHandler, false); m_scene.ForEachClient(clientPacketHandler);
// If nothing was sent, sleep for the minimum amount of time before a // If nothing was sent, sleep for the minimum amount of time before a
// token bucket could get more tokens // token bucket could get more tokens

View File

@ -642,7 +642,7 @@ namespace Flotsam.RegionModules.AssetCache
{ {
UuidGatherer gatherer = new UuidGatherer(m_AssetService); UuidGatherer gatherer = new UuidGatherer(m_AssetService);
Dictionary<UUID, int> assets = new Dictionary<UUID, int>(); Dictionary<UUID, AssetType> assets = new Dictionary<UUID, AssetType>();
foreach (Scene s in m_Scenes) foreach (Scene s in m_Scenes)
{ {
StampRegionStatusFile(s.RegionInfo.RegionID); StampRegionStatusFile(s.RegionInfo.RegionID);

View File

@ -89,60 +89,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
get { return true; } get { return true; }
} }
private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar) private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar)
{ {
string deadAvatarMessage;
ScenePresence killingAvatar = null;
string killingAvatarMessage;
if (killerObjectLocalID == 0) if (killerObjectLocalID == 0)
DeadAvatar.ControllingClient.SendAgentAlertMessage("You committed suicide!", true); deadAvatarMessage = "You committed suicide!";
else else
{ {
bool foundResult = false; // Try to get the avatar responsible for the killing
string resultstring = String.Empty; killingAvatar = deadAvatar.Scene.GetScenePresence(killerObjectLocalID);
ScenePresence[] allav = DeadAvatar.Scene.GetScenePresences(); if (killingAvatar == null)
{
// Try to get the object which was responsible for the killing
SceneObjectPart part = deadAvatar.Scene.GetSceneObjectPart(killerObjectLocalID);
if (part == null)
{
// Cause of death: Unknown
deadAvatarMessage = "You died!";
}
else
{
// Try to find the avatar wielding the killing object
killingAvatar = deadAvatar.Scene.GetScenePresence(part.OwnerID);
if (killingAvatar == null)
deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, deadAvatar.Scene.GetUserName(part.OwnerID));
else
{
killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name);
}
}
}
else
{
killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name);
}
}
try try
{ {
for (int i = 0; i < allav.Length; i++) deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
{ if(killingAvatar != null)
ScenePresence av = allav[i]; killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
}
catch (InvalidOperationException)
{ }
if (av.LocalId == killerObjectLocalID) deadAvatar.Health = 100;
{ deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient);
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
resultstring = av.Firstname + " " + av.Lastname;
foundResult = true;
}
}
} catch (InvalidOperationException)
{
}
if (!foundResult)
{
SceneObjectPart part = DeadAvatar.Scene.GetSceneObjectPart(killerObjectLocalID);
if (part != null)
{
ScenePresence av = DeadAvatar.Scene.GetScenePresence(part.OwnerID);
if (av != null)
{
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
resultstring = av.Firstname + " " + av.Lastname;
DeadAvatar.ControllingClient.SendAgentAlertMessage("You got killed by " + resultstring + "!", true);
}
else
{
string killer = DeadAvatar.Scene.GetUserName(part.OwnerID);
DeadAvatar.ControllingClient.SendAgentAlertMessage("You impaled yourself on " + part.Name + " owned by " + killer +"!", true);
}
//DeadAvatar.Scene. part.ObjectOwner
}
else
{
DeadAvatar.ControllingClient.SendAgentAlertMessage("You died!", true);
}
}
}
DeadAvatar.Health = 100;
DeadAvatar.Scene.TeleportClientHome(DeadAvatar.UUID, DeadAvatar.ControllingClient);
} }
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)

View File

@ -87,31 +87,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
public void SendAlertToUser(string firstName, string lastName, string message, bool modal) public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
{ {
ScenePresence[] presenceList = m_scene.GetScenePresences(); ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
if(presence != null)
for (int i = 0; i < presenceList.Length; i++)
{
ScenePresence presence = presenceList[i];
if (presence.Firstname == firstName && presence.Lastname == lastName)
{
presence.ControllingClient.SendAgentAlertMessage(message, modal); presence.ControllingClient.SendAgentAlertMessage(message, modal);
break;
}
}
} }
public void SendGeneralAlert(string message) public void SendGeneralAlert(string message)
{ {
ScenePresence[] presenceList = m_scene.GetScenePresences(); m_scene.ForEachScenePresence(delegate(ScenePresence presence)
for (int i = 0; i < presenceList.Length; i++)
{ {
ScenePresence presence = presenceList[i];
if (!presence.IsChildAgent) if (!presence.IsChildAgent)
presence.ControllingClient.SendAlertMessage(message); presence.ControllingClient.SendAlertMessage(message);
} });
} }
public void SendDialogToUser( public void SendDialogToUser(
@ -179,14 +166,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
public void SendNotificationToUsersInRegion( public void SendNotificationToUsersInRegion(
UUID fromAvatarID, string fromAvatarName, string message) UUID fromAvatarID, string fromAvatarName, string message)
{ {
ScenePresence[] presences = m_scene.GetScenePresences(); m_scene.ForEachScenePresence(delegate(ScenePresence presence)
for (int i = 0; i < presences.Length; i++)
{ {
ScenePresence presence = presences[i];
if (!presence.IsChildAgent) if (!presence.IsChildAgent)
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
} });
} }
/// <summary> /// <summary>

View File

@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <value> /// <value>
/// Used to collect the uuids of the assets that we need to save into the archive /// Used to collect the uuids of the assets that we need to save into the archive
/// </value> /// </value>
protected Dictionary<UUID, int> m_assetUuids = new Dictionary<UUID, int>(); protected Dictionary<UUID, AssetType> m_assetUuids = new Dictionary<UUID, AssetType>();
/// <value> /// <value>
/// Used to collect the uuids of the users that we need to save into the archive /// Used to collect the uuids of the users that we need to save into the archive
@ -305,7 +305,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
new AssetsRequest( new AssetsRequest(
new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, new AssetsArchiver(m_archiveWriter), m_assetUuids,
m_scene.AssetService, ReceivedAllAssets).Execute(); m_scene.AssetService, ReceivedAllAssets).Execute();
} }

View File

@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (asset != null) if (asset != null)
{ {
// OK, now fetch the inside. // OK, now fetch the inside.
Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
foreach (UUID uuid in ids.Keys) foreach (UUID uuid in ids.Keys)
@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
if (asset != null) if (asset != null)
{ {
Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
foreach (UUID uuid in ids.Keys) foreach (UUID uuid in ids.Keys)

View File

@ -285,24 +285,22 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
return; return;
} }
byte[] assetData; byte[] assetData = null;
AssetBase oldAsset = null; AssetBase oldAsset = null;
if (BlendWithOldTexture) if (BlendWithOldTexture)
{ {
UUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID; Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture;
oldAsset = scene.AssetService.Get(lastTextureID.ToString()); if (defaultFace != null)
if (oldAsset != null)
{ {
oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString());
if (oldAsset != null)
assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha); assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
} }
else
{
assetData = new byte[data.Length];
Array.Copy(data, assetData, data.Length);
} }
}
else if (assetData == null)
{ {
assetData = new byte[data.Length]; assetData = new byte[data.Length];
Array.Copy(data, assetData, data.Length); Array.Copy(data, assetData, data.Length);

View File

@ -166,6 +166,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return m_sceneList[0]; return m_sceneList[0];
} }
public ISimulationService GetInnerService()
{
return this;
}
/** /**
* Agent-related communications * Agent-related communications
*/ */

View File

@ -156,6 +156,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return m_localBackend.GetScene(handle); return m_localBackend.GetScene(handle);
} }
public ISimulationService GetInnerService()
{
return m_localBackend;
}
/** /**
* Agent-related communications * Agent-related communications
*/ */

View File

@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception> /// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception>
public void ArchiveRegion() public void ArchiveRegion()
{ {
Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>(); Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
List<EntityBase> entities = m_scene.GetEntities(); List<EntityBase> entities = m_scene.GetEntities();
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
@ -144,16 +144,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings; RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings;
if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1) if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1)
assetUuids[regionSettings.TerrainTexture1] = 1; assetUuids[regionSettings.TerrainTexture1] = AssetType.Texture;
if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2) if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2)
assetUuids[regionSettings.TerrainTexture2] = 1; assetUuids[regionSettings.TerrainTexture2] = AssetType.Texture;
if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3) if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3)
assetUuids[regionSettings.TerrainTexture3] = 1; assetUuids[regionSettings.TerrainTexture3] = AssetType.Texture;
if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4) if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4)
assetUuids[regionSettings.TerrainTexture4] = 1; assetUuids[regionSettings.TerrainTexture4] = AssetType.Texture;
TarArchiveWriter archiveWriter = new TarArchiveWriter(m_saveStream); TarArchiveWriter archiveWriter = new TarArchiveWriter(m_saveStream);
@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_requestId); m_requestId);
new AssetsRequest( new AssetsRequest(
new AssetsArchiver(archiveWriter), assetUuids.Keys, new AssetsArchiver(archiveWriter), assetUuids,
m_scene.AssetService, awre.ReceivedAllAssets).Execute(); m_scene.AssetService, awre.ReceivedAllAssets).Execute();
} }
} }

View File

@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <value> /// <value>
/// uuids to request /// uuids to request
/// </value> /// </value>
protected ICollection<UUID> m_uuids; protected IDictionary<UUID, AssetType> m_uuids;
/// <value> /// <value>
/// Callback used when all the assets requested have been received. /// Callback used when all the assets requested have been received.
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
protected AssetsArchiver m_assetsArchiver; protected AssetsArchiver m_assetsArchiver;
protected internal AssetsRequest( protected internal AssetsRequest(
AssetsArchiver assetsArchiver, ICollection<UUID> uuids, AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids,
IAssetService assetService, AssetsRequestCallback assetsRequestCallback) IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
{ {
m_assetsArchiver = assetsArchiver; m_assetsArchiver = assetsArchiver;
@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
return; return;
} }
foreach (UUID uuid in m_uuids) foreach (KeyValuePair<UUID, AssetType> kvp in m_uuids)
{ {
m_assetService.Get(uuid.ToString(), this, AssetRequestCallback); m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback);
} }
m_requestCallbackTimer.Enabled = true; m_requestCallbackTimer.Enabled = true;
@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure
// case anyway. // case anyway.
List<UUID> uuids = new List<UUID>(); List<UUID> uuids = new List<UUID>();
foreach (UUID uuid in m_uuids) foreach (UUID uuid in m_uuids.Keys)
{ {
uuids.Add(uuid); uuids.Add(uuid);
} }
@ -200,6 +200,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
} }
protected void PreAssetRequestCallback(string fetchedAssetID, object assetType, AssetBase fetchedAsset)
{
// Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer
if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown)
{
AssetType type = (AssetType)assetType;
m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, type);
fetchedAsset.Type = (sbyte)type;
}
AssetRequestCallback(fetchedAssetID, this, fetchedAsset);
}
/// <summary> /// <summary>
/// Called back by the asset cache when it has the asset /// Called back by the asset cache when it has the asset
/// </summary> /// </summary>

View File

@ -469,12 +469,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
{ {
// Get a fresh list that will not change as people get teleported away // Get a fresh list that will not change as people get teleported away
ScenePresence[] presences = m_scene.GetScenePresences(); List<ScenePresence> presences = m_scene.GetScenePresences();
for (int i = 0; i < presences.Length; i++) foreach(ScenePresence p in presences)
{ {
ScenePresence p = presences[i];
if (p.UUID != senderID) if (p.UUID != senderID)
{ {
// make sure they are still there, we could be working down a long list // make sure they are still there, we could be working down a long list

View File

@ -1276,13 +1276,104 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene) private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene)
{ {
if (objects.Count == 0)
return false;
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue; if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericObjectPermission(user, objects[0].UUID, false); GroupPowers powers;
ILandObject l;
ScenePresence sp = scene.GetScenePresence(user);
if (sp == null)
return false;
IClientAPI client = sp.ControllingClient;
foreach (SceneObjectGroup g in new List<SceneObjectGroup>(objects))
{
// Any user can return their own objects at any time
//
if (GenericObjectPermission(user, g.UUID, false))
continue;
// This is a short cut for efficiency. If land is non-null,
// then all objects are on that parcel and we can save
// ourselves the checking for each prim. Much faster.
//
if (land != null)
{
l = land;
}
else
{
Vector3 pos = g.AbsolutePosition;
l = scene.LandChannel.GetLandObject(pos.X, pos.Y);
}
// If it's not over any land, then we can't do a thing
if (l == null)
{
objects.Remove(g);
continue;
}
// If we own the land outright, then allow
//
if (l.LandData.OwnerID == user)
continue;
// Group voodoo
//
if (land.LandData.IsGroupOwned)
{
powers = (GroupPowers)client.GetGroupPowers(land.LandData.GroupID);
// Not a group member, or no rights at all
//
if (powers == (GroupPowers)0)
{
objects.Remove(g);
continue;
}
// Group deeded object?
//
if (g.OwnerID == l.LandData.GroupID &&
(powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0)
{
objects.Remove(g);
continue;
}
// Group set object?
//
if (g.GroupID == l.LandData.GroupID &&
(powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0)
{
objects.Remove(g);
continue;
}
if ((powers & GroupPowers.ReturnNonGroup) == (GroupPowers)0)
{
objects.Remove(g);
continue;
}
// So we can remove all objects from this group land.
// Fine.
//
continue;
}
// By default, we can't remove
//
objects.Remove(g);
}
if (objects.Count == 0)
return false;
return true;
} }
private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)

View File

@ -251,13 +251,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// if you want tree blocks on the map comment the above line and uncomment the below line // if you want tree blocks on the map comment the above line and uncomment the below line
//mapdotspot = Color.PaleGreen; //mapdotspot = Color.PaleGreen;
if (part.Shape.Textures == null) Primitive.TextureEntry textureEntry = part.Shape.Textures;
if (textureEntry == null || textureEntry.DefaultTexture == null)
continue; continue;
if (part.Shape.Textures.DefaultTexture == null) Color4 texcolor = textureEntry.DefaultTexture.RGBA;
continue;
Color4 texcolor = part.Shape.Textures.DefaultTexture.RGBA;
// Not sure why some of these are null, oh well. // Not sure why some of these are null, oh well.

View File

@ -203,18 +203,25 @@ namespace OpenSim.Region.DataSnapshot.Providers
{ {
string bestguess = string.Empty; string bestguess = string.Empty;
Dictionary<UUID, int> counts = new Dictionary<UUID, int>(); Dictionary<UUID, int> counts = new Dictionary<UUID, int>();
if (sog.RootPart.Shape != null && sog.RootPart.Shape.ProfileShape == ProfileShape.Square &&
sog.RootPart.Shape.Textures != null && sog.RootPart.Shape.Textures.FaceTextures != null) PrimitiveBaseShape shape = sog.RootPart.Shape;
if (shape != null && shape.ProfileShape == ProfileShape.Square)
{ {
if (sog.RootPart.Shape.Textures.DefaultTexture.TextureID != UUID.Zero && Primitive.TextureEntry textures = shape.Textures;
sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_DefaultImage && if (textures != null)
sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_BlankImage &&
sog.RootPart.Shape.Textures.DefaultTexture.RGBA.A < 50)
{ {
counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = 8; if (textures.DefaultTexture != null &&
textures.DefaultTexture.TextureID != UUID.Zero &&
textures.DefaultTexture.TextureID != m_DefaultImage &&
textures.DefaultTexture.TextureID != m_BlankImage &&
textures.DefaultTexture.RGBA.A < 50f)
{
counts[textures.DefaultTexture.TextureID] = 8;
} }
foreach (Primitive.TextureEntryFace tentry in sog.RootPart.Shape.Textures.FaceTextures) if (textures.FaceTextures != null)
{
foreach (Primitive.TextureEntryFace tentry in textures.FaceTextures)
{ {
if (tentry != null) if (tentry != null)
{ {
@ -224,8 +231,9 @@ namespace OpenSim.Region.DataSnapshot.Providers
counts.TryGetValue(tentry.TextureID, out c); counts.TryGetValue(tentry.TextureID, out c);
counts[tentry.TextureID] = c + 1; counts[tentry.TextureID] = c + 1;
// decrease the default texture count // decrease the default texture count
if (counts.ContainsKey(sog.RootPart.Shape.Textures.DefaultTexture.TextureID)) if (counts.ContainsKey(textures.DefaultTexture.TextureID))
counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] - 1; counts[textures.DefaultTexture.TextureID] = counts[textures.DefaultTexture.TextureID] - 1;
}
} }
} }
} }
@ -241,6 +249,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
} }
} }
} }
}
return bestguess; return bestguess;
} }
} }

View File

@ -131,7 +131,6 @@ namespace OpenSim.Region.Framework.Scenes
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds; private int m_incrementsof15seconds;
private volatile bool m_backingup; private volatile bool m_backingup;
private bool m_useAsyncWhenPossible;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
@ -656,9 +655,6 @@ namespace OpenSim.Region.Framework.Scenes
// //
IConfig startupConfig = m_config.Configs["Startup"]; IConfig startupConfig = m_config.Configs["Startup"];
// Should we try to run loops synchronously or asynchronously?
m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", false);
//Animation states //Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
// TODO: Change default to true once the feature is supported // TODO: Change default to true once the feature is supported
@ -3636,9 +3632,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{ {
ScenePresence presence; ScenePresence presence;
m_sceneGraph.TryGetAvatar(agentID, out presence); if(m_sceneGraph.TryGetAvatar(agentID, out presence))
if (presence != null)
{ {
try try
{ {
@ -3813,9 +3807,7 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 lookAt, uint teleportFlags) Vector3 lookAt, uint teleportFlags)
{ {
ScenePresence sp; ScenePresence sp;
m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp); if(m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp))
if (sp != null)
{ {
uint regionX = m_regInfo.RegionLocX; uint regionX = m_regInfo.RegionLocX;
uint regionY = m_regInfo.RegionLocY; uint regionY = m_regInfo.RegionLocY;
@ -4171,6 +4163,11 @@ namespace OpenSim.Region.Framework.Scenes
//The idea is to have a group of method that return a list of avatars meeting some requirement //The idea is to have a group of method that return a list of avatars meeting some requirement
// ie it could be all m_scenePresences within a certain range of the calling prim/avatar. // ie it could be all m_scenePresences within a certain range of the calling prim/avatar.
//
// GetAvatars returns a new list of all root agent presences in the scene
// GetScenePresences returns a new list of all presences in the scene or a filter may be passed.
// GetScenePresence returns the presence with matching UUID or first/last name.
// ForEachScenePresence requests the Scene to run a delegate function against all presences.
/// <summary> /// <summary>
/// Return a list of all avatars in this region. /// Return a list of all avatars in this region.
@ -4187,7 +4184,7 @@ namespace OpenSim.Region.Framework.Scenes
/// This list is a new object, so it can be iterated over without locking. /// This list is a new object, so it can be iterated over without locking.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ScenePresence[] GetScenePresences() public List<ScenePresence> GetScenePresences()
{ {
return m_sceneGraph.GetScenePresences(); return m_sceneGraph.GetScenePresences();
} }
@ -4213,6 +4210,28 @@ namespace OpenSim.Region.Framework.Scenes
return m_sceneGraph.GetScenePresence(avatarID); return m_sceneGraph.GetScenePresence(avatarID);
} }
/// <summary>
/// Request the ScenePresence in this region by first/last name.
/// Should normally only be a single match, but first is always returned
/// </summary>
/// <param name="firstName"></param>
/// <param name="lastName"></param>
/// <returns></returns>
public ScenePresence GetScenePresence(string firstName, string lastName)
{
return m_sceneGraph.GetScenePresence(firstName, lastName);
}
/// <summary>
/// Request the ScenePresence in this region by localID.
/// </summary>
/// <param name="localID"></param>
/// <returns></returns>
public ScenePresence GetScenePresence(uint localID)
{
return m_sceneGraph.GetScenePresence(localID);
}
public override bool PresenceChildStatus(UUID avatarID) public override bool PresenceChildStatus(UUID avatarID)
{ {
ScenePresence cp = GetScenePresence(avatarID); ScenePresence cp = GetScenePresence(avatarID);
@ -4228,25 +4247,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// /// Performs action on all scene presences.
/// </summary> /// </summary>
/// <param name="action"></param> /// <param name="action"></param>
public void ForEachScenePresence(Action<ScenePresence> action) public void ForEachScenePresence(Action<ScenePresence> action)
{ {
// We don't want to try to send messages if there are no avatars.
if (m_sceneGraph != null) if (m_sceneGraph != null)
{ {
try m_sceneGraph.ForEachScenePresence(action);
{
ScenePresence[] presences = GetScenePresences();
for (int i = 0; i < presences.Length; i++)
action(presences[i]);
}
catch (Exception e)
{
m_log.Info("[BUG] in " + RegionInfo.RegionName + ": " + e.ToString());
m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
}
} }
} }
@ -4322,20 +4330,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ForEachClient(Action<IClientAPI> action) public void ForEachClient(Action<IClientAPI> action)
{ {
ForEachClient(action, m_useAsyncWhenPossible);
}
public void ForEachClient(Action<IClientAPI> action, bool doAsynchronous)
{
// FIXME: Asynchronous iteration is disabled until we have a threading model that
// can support calling this function from an async packet handler without
// potentially deadlocking
m_clientManager.ForEachSync(action); m_clientManager.ForEachSync(action);
//if (doAsynchronous)
// m_clientManager.ForEach(action);
//else
// m_clientManager.ForEachSync(action);
} }
public bool TryGetClient(UUID avatarID, out IClientAPI client) public bool TryGetClient(UUID avatarID, out IClientAPI client)

View File

@ -165,9 +165,10 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void UpdatePresences() protected internal void UpdatePresences()
{ {
ScenePresence[] updateScenePresences = GetScenePresences(); ForEachScenePresence(delegate(ScenePresence presence)
for (int i = 0; i < updateScenePresences.Length; i++) {
updateScenePresences[i].Update(); presence.Update();
});
} }
protected internal float UpdatePhysics(double elapsed) protected internal float UpdatePhysics(double elapsed)
@ -196,9 +197,10 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void UpdateScenePresenceMovement() protected internal void UpdateScenePresenceMovement()
{ {
ScenePresence[] moveEntities = GetScenePresences(); ForEachScenePresence(delegate(ScenePresence presence)
for (int i = 0; i < moveEntities.Length; i++) {
moveEntities[i].UpdateMovement(); presence.UpdateMovement();
});
} }
#endregion #endregion
@ -640,18 +642,16 @@ namespace OpenSim.Region.Framework.Scenes
public void RecalculateStats() public void RecalculateStats()
{ {
ScenePresence[] presences = GetScenePresences();
int rootcount = 0; int rootcount = 0;
int childcount = 0; int childcount = 0;
for (int i = 0; i < presences.Length; i++) ForEachScenePresence(delegate(ScenePresence presence)
{ {
ScenePresence user = presences[i]; if (presence.IsChildAgent)
if (user.IsChildAgent)
++childcount; ++childcount;
else else
++rootcount; ++rootcount;
} });
m_numRootAgents = rootcount; m_numRootAgents = rootcount;
m_numChildAgents = childcount; m_numChildAgents = childcount;
@ -698,25 +698,6 @@ namespace OpenSim.Region.Framework.Scenes
#endregion #endregion
#region Get Methods #region Get Methods
/// <summary>
/// Request a List of all scene presences in this scene. This is a new list, so no
/// locking is required to iterate over it.
/// </summary>
/// <returns></returns>
protected internal ScenePresence[] GetScenePresences()
{
return m_scenePresenceArray;
}
protected internal List<ScenePresence> GetAvatars()
{
List<ScenePresence> result =
GetScenePresences(delegate(ScenePresence scenePresence) { return !scenePresence.IsChildAgent; });
return result;
}
/// <summary> /// <summary>
/// Get the controlling client for the given avatar, if there is one. /// Get the controlling client for the given avatar, if there is one.
/// ///
@ -742,42 +723,116 @@ namespace OpenSim.Region.Framework.Scenes
return null; return null;
} }
// The idea is to have a group of method that return a list of avatars meeting some requirement
// ie it could be all m_scenePresences within a certain range of the calling prim/avatar.
//
// GetAvatars returns a new list of all root agent presences in the scene
// GetScenePresences returns a new list of all presences in the scene or a filter may be passed.
// GetScenePresence returns the presence with matching UUID or the first presence matching the passed filter.
// ForEachScenePresence requests the Scene to run a delegate function against all presences.
/// <summary>
/// Request a list of all avatars in this region (no child agents)
/// This list is a new object, so it can be iterated over without locking.
/// </summary>
/// <returns></returns>
public List<ScenePresence> GetAvatars()
{
return GetScenePresences(delegate(ScenePresence scenePresence)
{
return !scenePresence.IsChildAgent;
});
}
/// <summary>
/// Request a list of m_scenePresences in this World
/// Returns a copy so it can be iterated without a lock.
/// There is no guarantee that presences will remain in the scene after the list is returned.
/// </summary>
/// <returns></returns>
protected internal List<ScenePresence> GetScenePresences()
{
List<ScenePresence> result;
lock (m_scenePresences)
{
result = new List<ScenePresence>(m_scenePresenceArray.Length);
result.AddRange(m_scenePresenceArray);
}
return result;
}
/// <summary> /// <summary>
/// Request a filtered list of m_scenePresences in this World /// Request a filtered list of m_scenePresences in this World
/// Returns a copy so it can be iterated without a lock.
/// There is no guarantee that presences will remain in the scene after the list is returned.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected internal List<ScenePresence> GetScenePresences(FilterAvatarList filter) protected internal List<ScenePresence> GetScenePresences(FilterAvatarList filter)
{ {
// No locking of scene presences here since we're passing back a list...
List<ScenePresence> result = new List<ScenePresence>(); List<ScenePresence> result = new List<ScenePresence>();
ScenePresence[] scenePresences = GetScenePresences(); // Check each ScenePresence against the filter
ForEachScenePresence(delegate(ScenePresence presence)
for (int i = 0; i < scenePresences.Length; i++)
{ {
ScenePresence avatar = scenePresences[i]; if (filter(presence))
if (filter(avatar)) result.Add(presence);
result.Add(avatar); });
return result;
} }
/// <summary>
/// Request the ScenePresence in this region matching filter.
/// Only the first match is returned.
///
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
protected internal ScenePresence GetScenePresence(FilterAvatarList filter)
{
ScenePresence result = null;
// Get all of the ScenePresences
List<ScenePresence> presences = GetScenePresences();
foreach (ScenePresence presence in presences)
{
if (filter(presence))
{
result = presence;
break;
}
}
return result; return result;
} }
protected internal ScenePresence GetScenePresence(string firstName, string lastName)
{
return GetScenePresence(delegate(ScenePresence presence)
{
return(presence.Firstname == firstName && presence.Lastname == lastName);
});
}
/// <summary> /// <summary>
/// Request a scene presence by UUID /// Request a scene presence by UUID
/// </summary> /// </summary>
/// <param name="avatarID"></param> /// <param name="agentID"></param>
/// <returns>null if the agent was not found</returns> /// <returns>null if the agent was not found</returns>
protected internal ScenePresence GetScenePresence(UUID agentID) protected internal ScenePresence GetScenePresence(UUID agentID)
{ {
ScenePresence sp; ScenePresence sp;
TryGetAvatar(agentID, out sp);
lock (m_scenePresences) return sp;
{
m_scenePresences.TryGetValue(agentID, out sp);
} }
return sp; /// <summary>
/// Request the ScenePresence in this region by localID.
/// </summary>
/// <param name="localID"></param>
/// <returns></returns>
protected internal ScenePresence GetScenePresence(uint localID)
{
return GetScenePresence(delegate(ScenePresence presence)
{
return (presence.LocalId == localID);
});
} }
/// <summary> /// <summary>
@ -934,29 +989,19 @@ namespace OpenSim.Region.Framework.Scenes
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar) protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
{ {
lock (m_scenePresences) lock (m_scenePresences)
return m_scenePresences.TryGetValue(avatarId, out avatar); {
m_scenePresences.TryGetValue(avatarId, out avatar);
}
return (avatar != null);
} }
protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
{ {
ScenePresence[] presences = GetScenePresences(); avatar = GetScenePresence(delegate(ScenePresence presence)
for (int i = 0; i < presences.Length; i++)
{ {
ScenePresence presence = presences[i]; return (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0);
});
if (!presence.IsChildAgent) return (avatar != null);
{
if (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0)
{
avatar = presence;
return true;
}
}
}
avatar = null;
return false;
} }
/// <summary> /// <summary>
@ -1038,6 +1083,28 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Performs action on all scene presences.
/// </summary>
/// <param name="action"></param>
public void ForEachScenePresence(Action<ScenePresence> action)
{
List<ScenePresence> presences = GetScenePresences();
try
{
foreach(ScenePresence presence in presences)
{
action(presence);
}
}
catch (Exception e)
{
m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
}
}
#endregion #endregion
#region Client Event handlers #region Client Event handlers

View File

@ -414,12 +414,8 @@ namespace OpenSim.Region.Framework.Scenes
ForEachCurrentScene( ForEachCurrentScene(
delegate(Scene scene) delegate(Scene scene)
{ {
ScenePresence[] scenePresences = scene.GetScenePresences(); scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
for (int i = 0; i < scenePresences.Length; i++)
{ {
ScenePresence scenePresence = scenePresences[i];
if (!scenePresence.IsChildAgent) if (!scenePresence.IsChildAgent)
{ {
m_log.DebugFormat("Packet debug for {0} {1} set to {2}", m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
@ -429,7 +425,7 @@ namespace OpenSim.Region.Framework.Scenes
scenePresence.ControllingClient.SetDebugPacketLevel(newDebug); scenePresence.ControllingClient.SetDebugPacketLevel(newDebug);
} }
} });
} }
); );
} }
@ -441,14 +437,11 @@ namespace OpenSim.Region.Framework.Scenes
ForEachCurrentScene( ForEachCurrentScene(
delegate(Scene scene) delegate(Scene scene)
{ {
ScenePresence[] scenePresences = scene.GetScenePresences(); scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
for (int i = 0; i < scenePresences.Length; i++)
{ {
ScenePresence scenePresence = scenePresences[i];
if (!scenePresence.IsChildAgent) if (!scenePresence.IsChildAgent)
avatars.Add(scenePresence); avatars.Add(scenePresence);
} });
} }
); );
@ -461,7 +454,7 @@ namespace OpenSim.Region.Framework.Scenes
ForEachCurrentScene(delegate(Scene scene) ForEachCurrentScene(delegate(Scene scene)
{ {
ScenePresence[] scenePresences = scene.GetScenePresences(); List<ScenePresence> scenePresences = scene.GetScenePresences();
presences.AddRange(scenePresences); presences.AddRange(scenePresences);
}); });

View File

@ -1370,8 +1370,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// part.Inventory.RemoveScriptInstances(); // part.Inventory.RemoveScriptInstances();
ScenePresence[] avatars = Scene.GetScenePresences(); List<ScenePresence> avatars = Scene.GetScenePresences();
for (int i = 0; i < avatars.Length; i++) for (int i = 0; i < avatars.Count; i++)
{ {
if (avatars[i].ParentID == LocalId) if (avatars[i].ParentID == LocalId)
{ {

View File

@ -1208,15 +1208,14 @@ namespace OpenSim.Region.Framework.Scenes
private void SendObjectPropertiesToClient(UUID AgentID) private void SendObjectPropertiesToClient(UUID AgentID)
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
for (int i = 0; i < avatars.Length; i++)
{ {
// Ugly reference :( // Ugly reference :(
if (avatars[i].UUID == AgentID) if (avatar.UUID == AgentID)
{ {
m_parentGroup.GetProperties(avatars[i].ControllingClient); m_parentGroup.GetProperties(avatar.ControllingClient);
}
} }
});
} }
// TODO: unused: // TODO: unused:
@ -1271,11 +1270,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void AddFullUpdateToAllAvatars() public void AddFullUpdateToAllAvatars()
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
for (int i = 0; i < avatars.Length; i++)
{ {
avatars[i].SceneViewer.QueuePartForUpdate(this); avatar.SceneViewer.QueuePartForUpdate(this);
} });
} }
public void AddFullUpdateToAvatar(ScenePresence presence) public void AddFullUpdateToAvatar(ScenePresence presence)
@ -1296,11 +1294,10 @@ namespace OpenSim.Region.Framework.Scenes
/// Terse updates /// Terse updates
public void AddTerseUpdateToAllAvatars() public void AddTerseUpdateToAllAvatars()
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
for (int i = 0; i < avatars.Length; i++)
{ {
avatars[i].SceneViewer.QueuePartForUpdate(this); avatar.SceneViewer.QueuePartForUpdate(this);
} });
} }
public void AddTerseUpdateToAvatar(ScenePresence presence) public void AddTerseUpdateToAvatar(ScenePresence presence)
@ -2137,12 +2134,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av)
for (int i = 0; i < avlist.Length; i++)
{ {
ScenePresence av = avlist[i];
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
@ -2187,7 +2180,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} });
} }
} }
if (colliding.Count > 0) if (colliding.Count > 0)
@ -2273,12 +2266,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av)
for (int i = 0; i < avlist.Length; i++)
{ {
ScenePresence av = avlist[i];
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
@ -2323,7 +2312,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} });
} }
} }
if (colliding.Count > 0) if (colliding.Count > 0)
@ -2404,12 +2393,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av)
for (int i = 0; i < avlist.Length; i++)
{ {
ScenePresence av = avlist[i];
if (av.LocalId == localId) if (av.LocalId == localId)
{ {
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
@ -2454,7 +2439,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} });
} }
} }
@ -2863,11 +2848,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendFullUpdateToAllClients() public void SendFullUpdateToAllClients()
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
for (int i = 0; i < avatars.Length; i++)
{ {
SendFullUpdate(avatars[i].ControllingClient, avatars[i].GenerateClientFlags(UUID)); SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID));
} });
} }
/// <summary> /// <summary>
@ -2876,13 +2860,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="agentID"></param> /// <param name="agentID"></param>
public void SendFullUpdateToAllClientsExcept(UUID agentID) public void SendFullUpdateToAllClientsExcept(UUID agentID)
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
for (int i = 0; i < avatars.Length; i++)
{ {
// Ugly reference :( // Ugly reference :(
if (avatars[i].UUID != agentID) if (avatar.UUID != agentID)
SendFullUpdate(avatars[i].ControllingClient, avatars[i].GenerateClientFlags(UUID)); SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID));
} });
} }
/// <summary> /// <summary>
@ -3083,11 +3066,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SendTerseUpdateToAllClients() public void SendTerseUpdateToAllClients()
{ {
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
for (int i = 0; i < avatars.Length; i++)
{ {
SendTerseUpdateToClient(avatars[i].ControllingClient); SendTerseUpdateToClient(avatar.ControllingClient);
} });
} }
public void SetAttachmentPoint(uint AttachmentPoint) public void SetAttachmentPoint(uint AttachmentPoint)

View File

@ -957,14 +957,11 @@ namespace OpenSim.Region.Framework.Scenes
m_isChildAgent = false; m_isChildAgent = false;
ScenePresence[] animAgents = m_scene.GetScenePresences(); m_scene.ForEachScenePresence(delegate(ScenePresence presence)
for (int i = 0; i < animAgents.Length; i++)
{ {
ScenePresence presence = animAgents[i];
if (presence != this) if (presence != this)
presence.Animator.SendAnimPackToClient(ControllingClient); presence.Animator.SendAnimPackToClient(ControllingClient);
} });
m_scene.EventManager.TriggerOnMakeRootAgent(this); m_scene.EventManager.TriggerOnMakeRootAgent(this);
} }
@ -2666,13 +2663,10 @@ namespace OpenSim.Region.Framework.Scenes
public void SendInitialFullUpdateToAllClients() public void SendInitialFullUpdateToAllClients()
{ {
m_perfMonMS = Util.EnvironmentTickCount(); m_perfMonMS = Util.EnvironmentTickCount();
int avUpdates = 0;
ScenePresence[] avatars = m_scene.GetScenePresences(); m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
for (int i = 0; i < avatars.Length; i++)
{ {
ScenePresence avatar = avatars[i]; ++avUpdates;
// only send if this is the root (children are only "listening posts" in a foreign region) // only send if this is the root (children are only "listening posts" in a foreign region)
if (!IsChildAgent) if (!IsChildAgent)
{ {
@ -2688,9 +2682,9 @@ namespace OpenSim.Region.Framework.Scenes
avatar.Animator.SendAnimPackToClient(ControllingClient); avatar.Animator.SendAnimPackToClient(ControllingClient);
} }
} }
} });
m_scene.StatsReporter.AddAgentUpdates(avatars.Length); m_scene.StatsReporter.AddAgentUpdates(avUpdates);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
//Animator.SendAnimPack(); //Animator.SendAnimPack();

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero); AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero);
m_assetService.Store(corruptAsset); m_assetService.Store(corruptAsset);
IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>(); IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids); m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids);
// We count the uuid as gathered even if the asset itself is corrupt. // We count the uuid as gathered even if the asset itself is corrupt.
@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestHelper.InMethod(); TestHelper.InMethod();
UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>(); IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids); m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids);

View File

@ -84,9 +84,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
/// <param name="assetType">The type of the asset for the uuid given</param> /// <param name="assetType">The type of the asset for the uuid given</param>
/// <param name="assetUuids">The assets gathered</param> /// <param name="assetUuids">The assets gathered</param>
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, int> assetUuids) public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
{ {
assetUuids[assetUuid] = 1; assetUuids[assetUuid] = assetType;
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType) if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
{ {
@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes
/// ///
/// <param name="sceneObject">The scene object for which to gather assets</param> /// <param name="sceneObject">The scene object for which to gather assets</param>
/// <param name="assetUuids">The assets gathered</param> /// <param name="assetUuids">The assets gathered</param>
public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, int> assetUuids) public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID); // "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
@ -129,25 +129,26 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
Primitive.TextureEntry textureEntry = part.Shape.Textures; Primitive.TextureEntry textureEntry = part.Shape.Textures;
if (textureEntry != null)
{
// Get the prim's default texture. This will be used for faces which don't have their own texture // Get the prim's default texture. This will be used for faces which don't have their own texture
assetUuids[textureEntry.DefaultTexture.TextureID] = 1; if (textureEntry.DefaultTexture != null)
assetUuids[textureEntry.DefaultTexture.TextureID] = AssetType.Texture;
// XXX: Not a great way to iterate through face textures, but there's no if (textureEntry.FaceTextures != null)
// other method available to tell how many faces there actually are {
//int i = 0; // Loop through the rest of the texture faces (a non-null face means the face is different from DefaultTexture)
foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures) foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures)
{ {
if (texture != null) if (texture != null)
{ assetUuids[texture.TextureID] = AssetType.Texture;
//m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++); }
assetUuids[texture.TextureID] = 1;
} }
} }
// If the prim is a sculpt then preserve this information too // If the prim is a sculpt then preserve this information too
if (part.Shape.SculptTexture != UUID.Zero) if (part.Shape.SculptTexture != UUID.Zero)
assetUuids[part.Shape.SculptTexture] = 1; assetUuids[part.Shape.SculptTexture] = AssetType.Texture;
TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
@ -217,7 +218,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
/// <param name="scriptUuid"></param> /// <param name="scriptUuid"></param>
/// <param name="assetUuids">Dictionary in which to record the references</param> /// <param name="assetUuids">Dictionary in which to record the references</param>
protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary<UUID, int> assetUuids) protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary<UUID, AssetType> assetUuids)
{ {
AssetBase scriptAsset = GetAsset(scriptUuid); AssetBase scriptAsset = GetAsset(scriptUuid);
@ -232,7 +233,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
UUID uuid = new UUID(uuidMatch.Value); UUID uuid = new UUID(uuidMatch.Value);
//m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid); //m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid);
assetUuids[uuid] = 1;
// Assume AssetIDs embedded in scripts are textures
assetUuids[uuid] = AssetType.Texture;
} }
} }
} }
@ -242,7 +245,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
/// <param name="wearableAssetUuid"></param> /// <param name="wearableAssetUuid"></param>
/// <param name="assetUuids">Dictionary in which to record the references</param> /// <param name="assetUuids">Dictionary in which to record the references</param>
protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, int> assetUuids) protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, AssetType> assetUuids)
{ {
AssetBase assetBase = GetAsset(wearableAssetUuid); AssetBase assetBase = GetAsset(wearableAssetUuid);
@ -257,8 +260,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (UUID uuid in wearableAsset.Textures.Values) foreach (UUID uuid in wearableAsset.Textures.Values)
{ {
//m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid); assetUuids[uuid] = AssetType.Texture;
assetUuids[uuid] = 1;
} }
} }
} }
@ -270,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <param name="assetUuids"></param> /// <param name="assetUuids"></param>
protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, int> assetUuids) protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, AssetType> assetUuids)
{ {
AssetBase objectAsset = GetAsset(sceneObjectUuid); AssetBase objectAsset = GetAsset(sceneObjectUuid);
@ -284,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, int> assetUuids) protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, AssetType> assetUuids)
{ {
AssetBase assetBase = GetAsset(gestureUuid); AssetBase assetBase = GetAsset(gestureUuid);
@ -316,7 +318,7 @@ namespace OpenSim.Region.Framework.Scenes
// If it can be parsed as a UUID, it is an asset ID // If it can be parsed as a UUID, it is an asset ID
UUID uuid; UUID uuid;
if (UUID.TryParse(id, out uuid)) if (UUID.TryParse(id, out uuid))
assetUuids[uuid] = 1; assetUuids[uuid] = AssetType.Animation;
} }
} }
} }

View File

@ -68,7 +68,7 @@ namespace OpenSim.Region.UserStatistics
HTMLUtil.OL_O(ref output, ""); HTMLUtil.OL_O(ref output, "");
foreach (Scene scene in all_scenes) foreach (Scene scene in all_scenes)
{ {
ScenePresence[] avatarInScene = scene.GetScenePresences(); List<ScenePresence> avatarInScene = scene.GetScenePresences();
HTMLUtil.LI_O(ref output, String.Empty); HTMLUtil.LI_O(ref output, String.Empty);
output.Append(scene.RegionInfo.RegionName); output.Append(scene.RegionInfo.RegionName);

View File

@ -104,7 +104,20 @@ namespace OpenSim.Server.Base
if (typeInterface != null) if (typeInterface != null)
{ {
return (T)Activator.CreateInstance(pluginType, args); T plug = null;
try
{
plug = (T)Activator.CreateInstance(pluginType,
args);
}
catch (Exception e)
{
if (!(e is System.MissingMethodException))
m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException);
return null;
}
return plug;
} }
} }
} }

View File

@ -55,6 +55,7 @@ namespace OpenSim.Server.Handlers.Simulation
//Object[] args = new Object[] { config }; //Object[] args = new Object[] { config };
m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>(); m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
//ServerUtils.LoadPlugin<ISimulationService>(simService, args); //ServerUtils.LoadPlugin<ISimulationService>(simService, args);
//System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));

View File

@ -85,7 +85,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "AssetServices")) if (Simian.IsSimianEnabled(source, "AssetServices", this.Name))
{ {
IConfig gridConfig = source.Configs["AssetService"]; IConfig gridConfig = source.Configs["AssetService"];
if (gridConfig == null) if (gridConfig == null)

View File

@ -73,7 +73,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "AuthenticationServices")) if (Simian.IsSimianEnabled(source, "AuthenticationServices", this.Name))
{ {
IConfig assetConfig = source.Configs["AuthenticationService"]; IConfig assetConfig = source.Configs["AuthenticationService"];
if (assetConfig == null) if (assetConfig == null)

View File

@ -78,7 +78,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "AvatarServices")) if (Simian.IsSimianEnabled(source, "AvatarServices", this.Name))
{ {
IConfig gridConfig = source.Configs["AvatarService"]; IConfig gridConfig = source.Configs["AvatarService"];
if (gridConfig == null) if (gridConfig == null)

View File

@ -76,7 +76,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "FriendsServices")) bool isSimianEnabled = false;
if (source.Configs["Friends"] != null)
{
string module = source.Configs["Friends"].GetString("Connector");
isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name);
}
if (isSimianEnabled)
{ {
IConfig assetConfig = source.Configs["FriendsService"]; IConfig assetConfig = source.Configs["FriendsService"];
if (assetConfig == null) if (assetConfig == null)

View File

@ -34,12 +34,12 @@ using Nini.Config;
public static class Simian public static class Simian
{ {
public static bool IsSimianEnabled(IConfigSource config, string moduleName) public static bool IsSimianEnabled(IConfigSource config, string moduleName, string connectorName)
{ {
if (config.Configs["Modules"] != null) if (config.Configs["Modules"] != null)
{ {
string module = config.Configs["Modules"].GetString("AuthenticationServices"); string module = config.Configs["Modules"].GetString(moduleName);
return !String.IsNullOrEmpty(module) && module.Contains("Simian"); return !String.IsNullOrEmpty(module) && module.EndsWith(connectorName);
} }
return false; return false;

View File

@ -80,7 +80,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "GridServices")) if (Simian.IsSimianEnabled(source, "GridServices", this.Name))
{ {
IConfig gridConfig = source.Configs["GridService"]; IConfig gridConfig = source.Configs["GridService"];
if (gridConfig == null) if (gridConfig == null)

View File

@ -92,7 +92,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "InventoryServices")) if (Simian.IsSimianEnabled(source, "InventoryServices", this.Name))
{ {
IConfig gridConfig = source.Configs["InventoryService"]; IConfig gridConfig = source.Configs["InventoryService"];
if (gridConfig == null) if (gridConfig == null)

View File

@ -104,7 +104,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "PresenceServices")) if (Simian.IsSimianEnabled(source, "PresenceServices", this.Name))
{ {
IConfig gridConfig = source.Configs["PresenceService"]; IConfig gridConfig = source.Configs["PresenceService"];
if (gridConfig == null) if (gridConfig == null)

View File

@ -88,7 +88,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "UserAccountServices")) if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name))
{ {
IConfig gridConfig = source.Configs["UserAccountService"]; IConfig gridConfig = source.Configs["UserAccountService"];
if (gridConfig == null) if (gridConfig == null)

View File

@ -77,7 +77,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (Simian.IsSimianEnabled(source, "UserAccountServices")) if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name))
{ {
IConfig assetConfig = source.Configs["UserAccountService"]; IConfig assetConfig = source.Configs["UserAccountService"];
if (assetConfig == null) if (assetConfig == null)

View File

@ -63,6 +63,11 @@ namespace OpenSim.Services.Connectors.Simulation
return null; return null;
} }
public ISimulationService GetInnerService()
{
return null;
}
#region Agents #region Agents
protected virtual string AgentPath() protected virtual string AgentPath()

View File

@ -36,6 +36,7 @@ namespace OpenSim.Services.Interfaces
public interface ISimulationService public interface ISimulationService
{ {
IScene GetScene(ulong regionHandle); IScene GetScene(ulong regionHandle);
ISimulationService GetInnerService();
#region Agents #region Agents

View File

@ -37,13 +37,6 @@
; performance on .NET/Windows ; performance on .NET/Windows
async_call_method = SmartThreadPool async_call_method = SmartThreadPool
; There are several operations on large collections (such as
; the current avatar list) that can be run synchronously or
; in parallel. Running in parallel should increase performance
; on a multi-core system, but will make debugging more
; difficult if something deadlocks or times out
use_async_when_possible = false
; Max threads to allocate on the FireAndForget thread pool ; Max threads to allocate on the FireAndForget thread pool
; when running with the SmartThreadPool option above ; when running with the SmartThreadPool option above
MaxPoolThreads = 15 MaxPoolThreads = 15

View File

@ -22,7 +22,7 @@
[Modules] [Modules]
GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector"
PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector"
UserAccountServices = "OpenSim.Services.Connectors.dll:SimianGridUserAccountServiceConnector" UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector"
AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector"
AssetServices = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector" AssetServices = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector"
InventoryServices = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector" InventoryServices = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector"