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
{
//m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length);
return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length);
//m_log.DebugFormat("[SHAPE]: get m_textureEntry length {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(); }

View File

@ -42,6 +42,7 @@ using Nwc.XmlRpc;
using OpenMetaverse.StructuredData;
using CoolHTTPListener = HttpServer.HttpListener;
using HttpListener=System.Net.HttpListener;
using LogPrio=HttpServer.LogPrio;
namespace OpenSim.Framework.Servers.HttpServer
{
@ -294,7 +295,7 @@ namespace OpenSim.Framework.Servers.HttpServer
headervals[headername] = req.Headers[headername];
}
keysvals.Add("headers",headervals);
keysvals.Add("headers", headervals);
keysvals.Add("querystringkeys", querystringkeys);
psEvArgs.Request(psreq.RequestID, keysvals);
@ -341,7 +342,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// 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
// handled
//m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl);
// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
IHttpAgentHandler agentHandler;
@ -496,7 +497,8 @@ namespace OpenSim.Framework.Servers.HttpServer
{
case null:
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);
return;
@ -524,10 +526,11 @@ namespace OpenSim.Framework.Servers.HttpServer
HandleLLSDRequests(request, response);
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))
{
//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);
return;
}
@ -623,7 +626,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler)
{
//m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);
// m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);
string bestMatch = null;
@ -943,7 +946,7 @@ namespace OpenSim.Framework.Servers.HttpServer
}
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)
{
@ -1219,6 +1222,10 @@ namespace OpenSim.Framework.Servers.HttpServer
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)
{
case "OPTIONS":
@ -1233,6 +1240,8 @@ namespace OpenSim.Framework.Servers.HttpServer
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.
// 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)
{
// m_log.DebugFormat(
// "[BASE HTTP SERVER]: Got query paremeter {0}={1}", queryname, request.QueryString[queryname]);
keysvals.Add(queryname, request.QueryString[queryname]);
requestVars.Add(queryname, keysvals[queryname]);
}
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];
}
@ -1288,15 +1299,16 @@ namespace OpenSim.Framework.Servers.HttpServer
host = (string)headervals["Host"];
}
keysvals.Add("headers",headervals);
keysvals.Add("headers", headervals);
keysvals.Add("querystringkeys", querystringkeys);
keysvals.Add("requestvars", requestVars);
// keysvals.Add("form", request.Form);
if (keysvals.Contains("method"))
{
//m_log.Warn("[HTTP]: Contains Method");
// m_log.Debug("[BASE HTTP SERVER]: Contains Method");
string method = (string) keysvals["method"];
//m_log.Warn("[HTTP]: " + requestBody);
// m_log.Debug("[BASE HTTP SERVER]: " + requestBody);
GenericHTTPMethod requestprocessor;
bool foundHandler = TryGetHTTPHandler(method, out requestprocessor);
if (foundHandler)
@ -1308,13 +1320,12 @@ namespace OpenSim.Framework.Servers.HttpServer
}
else
{
//m_log.Warn("[HTTP]: Handler Not Found");
// m_log.Warn("[BASE HTTP SERVER]: Handler Not Found");
SendHTML404(response, host);
}
}
else
{
GenericHTTPMethod requestprocessor;
bool foundHandler = TryGetHTTPHandlerPathBased(request.RawUrl, out requestprocessor);
if (foundHandler)
@ -1326,7 +1337,7 @@ namespace OpenSim.Framework.Servers.HttpServer
}
else
{
//m_log.Warn("[HTTP]: Handler Not Found");
// m_log.Warn("[BASE HTTP SERVER]: Handler Not Found2");
SendHTML404(response, host);
}
}
@ -1374,8 +1385,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
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 != "/")
bestMatch = pattern;
}
@ -1814,30 +1824,36 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <summary>
/// Relays HttpServer log messages to our own logging mechanism.
/// </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
{
//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)
{
/*
switch (priority)
{
case HttpServer.LogPrio.Debug:
m_log.DebugFormat("[{0}]: {1}", source.ToString(), message);
case LogPrio.Trace:
m_log.DebugFormat("[{0}]: {1}", source, message);
break;
case HttpServer.LogPrio.Error:
m_log.ErrorFormat("[{0}]: {1}", source.ToString(), message);
case LogPrio.Debug:
m_log.DebugFormat("[{0}]: {1}", source, message);
break;
case HttpServer.LogPrio.Info:
m_log.InfoFormat("[{0}]: {1}", source.ToString(), message);
case LogPrio.Error:
m_log.ErrorFormat("[{0}]: {1}", source, message);
break;
case HttpServer.LogPrio.Warning:
m_log.WarnFormat("[{0}]: {1}", source.ToString(), message);
case LogPrio.Info:
m_log.InfoFormat("[{0}]: {1}", source, message);
break;
case HttpServer.LogPrio.Fatal:
m_log.ErrorFormat("[{0}]: FATAL! - {1}", source.ToString(), message);
case LogPrio.Warning:
m_log.WarnFormat("[{0}]: {1}", source, message);
break;
case LogPrio.Fatal:
m_log.ErrorFormat("[{0}]: FATAL! - {1}", source, message);
break;
default:
break;

View File

@ -127,6 +127,11 @@ namespace OpenSim.Framework.Servers.HttpServer
}
private Hashtable _query;
/// <value>
/// POST request values, if applicable
/// </value>
// public Hashtable Form { get; private set; }
public string RawUrl
{
get { return _request.Uri.AbsolutePath; }
@ -228,6 +233,13 @@ namespace OpenSim.Framework.Servers.HttpServer
{
_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()

View File

@ -897,7 +897,7 @@ namespace OpenSim
{
connections.AppendFormat("{0}: {1} ({2}) from {3} on circuit {4}\n",
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
// 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
// token bucket could get more tokens

View File

@ -642,7 +642,7 @@ namespace Flotsam.RegionModules.AssetCache
{
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)
{
StampRegionStatusFile(s.RegionInfo.RegionID);

View File

@ -89,60 +89,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
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)
DeadAvatar.ControllingClient.SendAgentAlertMessage("You committed suicide!", true);
deadAvatarMessage = "You committed suicide!";
else
{
bool foundResult = false;
string resultstring = String.Empty;
ScenePresence[] allav = DeadAvatar.Scene.GetScenePresences();
try
// Try to get the avatar responsible for the killing
killingAvatar = deadAvatar.Scene.GetScenePresence(killerObjectLocalID);
if (killingAvatar == null)
{
for (int i = 0; i < allav.Length; i++)
// Try to get the object which was responsible for the killing
SceneObjectPart part = deadAvatar.Scene.GetSceneObjectPart(killerObjectLocalID);
if (part == null)
{
ScenePresence av = allav[i];
if (av.LocalId == killerObjectLocalID)
{
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
// Cause of death: Unknown
deadAvatarMessage = "You died!";
}
else
{
DeadAvatar.ControllingClient.SendAgentAlertMessage("You died!", true);
// 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);
}
}
DeadAvatar.Health = 100;
DeadAvatar.Scene.TeleportClientHome(DeadAvatar.UUID, DeadAvatar.ControllingClient);
try
{
deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
if(killingAvatar != null)
killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
}
catch (InvalidOperationException)
{ }
deadAvatar.Health = 100;
deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient);
}
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)
{
ScenePresence[] presenceList = m_scene.GetScenePresences();
for (int i = 0; i < presenceList.Length; i++)
{
ScenePresence presence = presenceList[i];
if (presence.Firstname == firstName && presence.Lastname == lastName)
{
presence.ControllingClient.SendAgentAlertMessage(message, modal);
break;
}
}
ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
if(presence != null)
presence.ControllingClient.SendAgentAlertMessage(message, modal);
}
public void SendGeneralAlert(string message)
{
ScenePresence[] presenceList = m_scene.GetScenePresences();
for (int i = 0; i < presenceList.Length; i++)
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
ScenePresence presence = presenceList[i];
if (!presence.IsChildAgent)
presence.ControllingClient.SendAlertMessage(message);
}
});
}
public void SendDialogToUser(
@ -179,14 +166,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
public void SendNotificationToUsersInRegion(
UUID fromAvatarID, string fromAvatarName, string message)
{
ScenePresence[] presences = m_scene.GetScenePresences();
for (int i = 0; i < presences.Length; i++)
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
ScenePresence presence = presences[i];
if (!presence.IsChildAgent)
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
}
});
}
/// <summary>

View File

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

View File

@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (asset != null)
{
// 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);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
foreach (UUID uuid in ids.Keys)
@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
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);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
foreach (UUID uuid in ids.Keys)

View File

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

View File

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

View File

@ -156,6 +156,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return m_localBackend.GetScene(handle);
}
public ISimulationService GetInnerService()
{
return m_localBackend;
}
/**
* 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>
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<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
@ -144,16 +144,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings;
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)
assetUuids[regionSettings.TerrainTexture2] = 1;
assetUuids[regionSettings.TerrainTexture2] = AssetType.Texture;
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)
assetUuids[regionSettings.TerrainTexture4] = 1;
assetUuids[regionSettings.TerrainTexture4] = AssetType.Texture;
TarArchiveWriter archiveWriter = new TarArchiveWriter(m_saveStream);
@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_requestId);
new AssetsRequest(
new AssetsArchiver(archiveWriter), assetUuids.Keys,
new AssetsArchiver(archiveWriter), assetUuids,
m_scene.AssetService, awre.ReceivedAllAssets).Execute();
}
}

View File

@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <value>
/// uuids to request
/// </value>
protected ICollection<UUID> m_uuids;
protected IDictionary<UUID, AssetType> m_uuids;
/// <value>
/// 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 internal AssetsRequest(
AssetsArchiver assetsArchiver, ICollection<UUID> uuids,
AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids,
IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
{
m_assetsArchiver = assetsArchiver;
@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
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;
@ -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
// case anyway.
List<UUID> uuids = new List<UUID>();
foreach (UUID uuid in m_uuids)
foreach (UUID uuid in m_uuids.Keys)
{
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>
/// Called back by the asset cache when it has the asset
/// </summary>

View File

@ -469,12 +469,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
{
// 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)
{
// 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)
{
if (objects.Count == 0)
return false;
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
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)

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
//mapdotspot = Color.PaleGreen;
if (part.Shape.Textures == null)
Primitive.TextureEntry textureEntry = part.Shape.Textures;
if (textureEntry == null || textureEntry.DefaultTexture == null)
continue;
if (part.Shape.Textures.DefaultTexture == null)
continue;
Color4 texcolor = part.Shape.Textures.DefaultTexture.RGBA;
Color4 texcolor = textureEntry.DefaultTexture.RGBA;
// Not sure why some of these are null, oh well.

View File

@ -203,44 +203,54 @@ namespace OpenSim.Region.DataSnapshot.Providers
{
string bestguess = string.Empty;
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)
{
if (sog.RootPart.Shape.Textures.DefaultTexture.TextureID != UUID.Zero &&
sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_DefaultImage &&
sog.RootPart.Shape.Textures.DefaultTexture.TextureID != m_BlankImage &&
sog.RootPart.Shape.Textures.DefaultTexture.RGBA.A < 50)
{
counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = 8;
}
foreach (Primitive.TextureEntryFace tentry in sog.RootPart.Shape.Textures.FaceTextures)
PrimitiveBaseShape shape = sog.RootPart.Shape;
if (shape != null && shape.ProfileShape == ProfileShape.Square)
{
Primitive.TextureEntry textures = shape.Textures;
if (textures != null)
{
if (tentry != null)
if (textures.DefaultTexture != null &&
textures.DefaultTexture.TextureID != UUID.Zero &&
textures.DefaultTexture.TextureID != m_DefaultImage &&
textures.DefaultTexture.TextureID != m_BlankImage &&
textures.DefaultTexture.RGBA.A < 50f)
{
if (tentry.TextureID != UUID.Zero && tentry.TextureID != m_DefaultImage && tentry.TextureID != m_BlankImage && tentry.RGBA.A < 50)
counts[textures.DefaultTexture.TextureID] = 8;
}
if (textures.FaceTextures != null)
{
foreach (Primitive.TextureEntryFace tentry in textures.FaceTextures)
{
int c = 0;
counts.TryGetValue(tentry.TextureID, out c);
counts[tentry.TextureID] = c + 1;
// decrease the default texture count
if (counts.ContainsKey(sog.RootPart.Shape.Textures.DefaultTexture.TextureID))
counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] = counts[sog.RootPart.Shape.Textures.DefaultTexture.TextureID] - 1;
if (tentry != null)
{
if (tentry.TextureID != UUID.Zero && tentry.TextureID != m_DefaultImage && tentry.TextureID != m_BlankImage && tentry.RGBA.A < 50)
{
int c = 0;
counts.TryGetValue(tentry.TextureID, out c);
counts[tentry.TextureID] = c + 1;
// decrease the default texture count
if (counts.ContainsKey(textures.DefaultTexture.TextureID))
counts[textures.DefaultTexture.TextureID] = counts[textures.DefaultTexture.TextureID] - 1;
}
}
}
}
// Let's pick the most unique texture
int min = 9999;
foreach (KeyValuePair<UUID, int> kv in counts)
{
if (kv.Value < min && kv.Value >= 1)
{
bestguess = kv.Key.ToString();
min = kv.Value;
}
}
}
// Let's pick the most unique texture
int min = 9999;
foreach (KeyValuePair<UUID, int> kv in counts)
{
if (kv.Value < min && kv.Value >= 1)
{
bestguess = kv.Key.ToString();
min = kv.Value;
}
}
}
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 int m_incrementsof15seconds;
private volatile bool m_backingup;
private bool m_useAsyncWhenPossible;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
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"];
// Should we try to run loops synchronously or asynchronously?
m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", false);
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
// 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)
{
ScenePresence presence;
m_sceneGraph.TryGetAvatar(agentID, out presence);
if (presence != null)
if(m_sceneGraph.TryGetAvatar(agentID, out presence))
{
try
{
@ -3813,9 +3807,7 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 lookAt, uint teleportFlags)
{
ScenePresence sp;
m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp);
if (sp != null)
if(m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp))
{
uint regionX = m_regInfo.RegionLocX;
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
// 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>
/// 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.
/// </summary>
/// <returns></returns>
public ScenePresence[] GetScenePresences()
public List<ScenePresence> GetScenePresences()
{
return m_sceneGraph.GetScenePresences();
}
@ -4213,6 +4210,28 @@ namespace OpenSim.Region.Framework.Scenes
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)
{
ScenePresence cp = GetScenePresence(avatarID);
@ -4228,25 +4247,14 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
///
/// Performs action on all scene presences.
/// </summary>
/// <param name="action"></param>
public void ForEachScenePresence(Action<ScenePresence> action)
{
// We don't want to try to send messages if there are no avatars.
if (m_sceneGraph != null)
{
try
{
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);
}
m_sceneGraph.ForEachScenePresence(action);
}
}
@ -4322,20 +4330,7 @@ namespace OpenSim.Region.Framework.Scenes
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);
//if (doAsynchronous)
// m_clientManager.ForEach(action);
//else
// m_clientManager.ForEachSync(action);
}
public bool TryGetClient(UUID avatarID, out IClientAPI client)

View File

@ -165,9 +165,10 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void UpdatePresences()
{
ScenePresence[] updateScenePresences = GetScenePresences();
for (int i = 0; i < updateScenePresences.Length; i++)
updateScenePresences[i].Update();
ForEachScenePresence(delegate(ScenePresence presence)
{
presence.Update();
});
}
protected internal float UpdatePhysics(double elapsed)
@ -196,9 +197,10 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void UpdateScenePresenceMovement()
{
ScenePresence[] moveEntities = GetScenePresences();
for (int i = 0; i < moveEntities.Length; i++)
moveEntities[i].UpdateMovement();
ForEachScenePresence(delegate(ScenePresence presence)
{
presence.UpdateMovement();
});
}
#endregion
@ -640,18 +642,16 @@ namespace OpenSim.Region.Framework.Scenes
public void RecalculateStats()
{
ScenePresence[] presences = GetScenePresences();
int rootcount = 0;
int childcount = 0;
for (int i = 0; i < presences.Length; i++)
ForEachScenePresence(delegate(ScenePresence presence)
{
ScenePresence user = presences[i];
if (user.IsChildAgent)
if (presence.IsChildAgent)
++childcount;
else
++rootcount;
}
});
m_numRootAgents = rootcount;
m_numChildAgents = childcount;
@ -698,25 +698,6 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#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>
/// Get the controlling client for the given avatar, if there is one.
///
@ -742,44 +723,118 @@ namespace OpenSim.Region.Framework.Scenes
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>
/// 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>
/// <returns></returns>
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>();
ScenePresence[] scenePresences = GetScenePresences();
for (int i = 0; i < scenePresences.Length; i++)
// Check each ScenePresence against the filter
ForEachScenePresence(delegate(ScenePresence presence)
{
ScenePresence avatar = scenePresences[i];
if (filter(avatar))
result.Add(avatar);
}
if (filter(presence))
result.Add(presence);
});
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;
}
protected internal ScenePresence GetScenePresence(string firstName, string lastName)
{
return GetScenePresence(delegate(ScenePresence presence)
{
return(presence.Firstname == firstName && presence.Lastname == lastName);
});
}
/// <summary>
/// Request a scene presence by UUID
/// </summary>
/// <param name="avatarID"></param>
/// <param name="agentID"></param>
/// <returns>null if the agent was not found</returns>
protected internal ScenePresence GetScenePresence(UUID agentID)
{
ScenePresence sp;
lock (m_scenePresences)
{
m_scenePresences.TryGetValue(agentID, out sp);
}
TryGetAvatar(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>
/// Get a scene object group that contains the prim with the given local id
/// </summary>
@ -934,29 +989,19 @@ namespace OpenSim.Region.Framework.Scenes
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
{
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)
{
ScenePresence[] presences = GetScenePresences();
for (int i = 0; i < presences.Length; i++)
avatar = GetScenePresence(delegate(ScenePresence presence)
{
ScenePresence presence = presences[i];
if (!presence.IsChildAgent)
{
if (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0)
{
avatar = presence;
return true;
}
}
}
avatar = null;
return false;
return (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0);
});
return (avatar != null);
}
/// <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
#region Client Event handlers

View File

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

View File

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

View File

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

View File

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

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero);
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);
// 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();
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);

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="assetType">The type of the asset for the uuid given</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)
{
@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// <param name="sceneObject">The scene object for which to gather assets</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(
// "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
@ -129,25 +129,26 @@ namespace OpenSim.Region.Framework.Scenes
try
{
Primitive.TextureEntry textureEntry = part.Shape.Textures;
// Get the prim's default texture. This will be used for faces which don't have their own texture
assetUuids[textureEntry.DefaultTexture.TextureID] = 1;
// XXX: Not a great way to iterate through face textures, but there's no
// other method available to tell how many faces there actually are
//int i = 0;
foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures)
if (textureEntry != null)
{
if (texture != null)
// Get the prim's default texture. This will be used for faces which don't have their own texture
if (textureEntry.DefaultTexture != null)
assetUuids[textureEntry.DefaultTexture.TextureID] = AssetType.Texture;
if (textureEntry.FaceTextures != null)
{
//m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++);
assetUuids[texture.TextureID] = 1;
// 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)
{
if (texture != null)
assetUuids[texture.TextureID] = AssetType.Texture;
}
}
}
// If the prim is a sculpt then preserve this information too
if (part.Shape.SculptTexture != UUID.Zero)
assetUuids[part.Shape.SculptTexture] = 1;
assetUuids[part.Shape.SculptTexture] = AssetType.Texture;
TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
@ -217,7 +218,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="scriptUuid"></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);
@ -232,7 +233,9 @@ namespace OpenSim.Region.Framework.Scenes
{
UUID uuid = new UUID(uuidMatch.Value);
//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>
/// <param name="wearableAssetUuid"></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);
@ -257,8 +260,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (UUID uuid in wearableAsset.Textures.Values)
{
//m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid);
assetUuids[uuid] = 1;
assetUuids[uuid] = AssetType.Texture;
}
}
}
@ -270,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="sceneObject"></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);
@ -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);
@ -316,7 +318,7 @@ namespace OpenSim.Region.Framework.Scenes
// If it can be parsed as a UUID, it is an asset ID
UUID 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, "");
foreach (Scene scene in all_scenes)
{
ScenePresence[] avatarInScene = scene.GetScenePresences();
List<ScenePresence> avatarInScene = scene.GetScenePresences();
HTMLUtil.LI_O(ref output, String.Empty);
output.Append(scene.RegionInfo.RegionName);

View File

@ -104,7 +104,20 @@ namespace OpenSim.Server.Base
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 };
m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
//ServerUtils.LoadPlugin<ISimulationService>(simService, args);
//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)
{
if (Simian.IsSimianEnabled(source, "AssetServices"))
if (Simian.IsSimianEnabled(source, "AssetServices", this.Name))
{
IConfig gridConfig = source.Configs["AssetService"];
if (gridConfig == null)

View File

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

View File

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

View File

@ -76,7 +76,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
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"];
if (assetConfig == null)

View File

@ -34,12 +34,12 @@ using Nini.Config;
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)
{
string module = config.Configs["Modules"].GetString("AuthenticationServices");
return !String.IsNullOrEmpty(module) && module.Contains("Simian");
string module = config.Configs["Modules"].GetString(moduleName);
return !String.IsNullOrEmpty(module) && module.EndsWith(connectorName);
}
return false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,13 +37,6 @@
; performance on .NET/Windows
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
; when running with the SmartThreadPool option above
MaxPoolThreads = 15

View File

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