This commit is contained in:
UbitUmarov
2017-07-20 11:30:12 +01:00
60 changed files with 2493 additions and 41860 deletions

View File

@@ -218,10 +218,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Count inventory items (different to asset count)
CountItems++;
// Don't chase down link asset items as they actually point to their target item IDs rather than an asset
if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder)
{
int curErrorCntr = m_assetGatherer.ErrorCount;
int possible = m_assetGatherer.possibleNotAssetCount;
m_assetGatherer.AddForInspection(inventoryItem.AssetID);
m_assetGatherer.GatherAll();
curErrorCntr = m_assetGatherer.ErrorCount - curErrorCntr;
possible = m_assetGatherer.possibleNotAssetCount - possible;
if(curErrorCntr > 0 || possible > 0)
{
string spath;
int indx = path.IndexOf("__");
if(indx > 0)
spath = path.Substring(0,indx);
else
spath = path;
if(curErrorCntr > 0)
{
m_log.ErrorFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references to missing or damaged assets",
inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath, curErrorCntr);
if(possible > 0)
m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item also contains {0} references that may be to missing or damaged assets or not a problem", possible);
}
else if(possible > 0)
{
m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references that may be to missing or damaged assets or not a problem", inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath, possible);
}
}
}
}
/// <summary>
@@ -381,6 +410,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
Exception e = new InventoryArchiverException(errorMessage);
m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0);
if(m_saveStream != null && m_saveStream.CanWrite)
m_saveStream.Close();
throw e;
}
@@ -420,17 +451,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
m_assetGatherer.GatherAll();
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetGatherer.GatheredUuids.Count);
int errors = m_assetGatherer.FailedUUIDs.Count;
AssetsRequest ar
= new AssetsRequest(
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: The items to save reference {0} possible assets", m_assetGatherer.GatheredUuids.Count + errors);
if(errors > 0)
m_log.DebugFormat("[INVENTORY ARCHIVER]: {0} of these have problems or are not assets and will be ignored", errors);
AssetsRequest ar = new AssetsRequest(
new AssetsArchiver(m_archiveWriter),
m_assetGatherer.GatheredUuids, m_scene.AssetService,
m_assetGatherer.GatheredUuids, m_assetGatherer.FailedUUIDs.Count,
m_scene.AssetService,
m_scene.UserAccountService, m_scene.RegionInfo.ScopeID,
options, ReceivedAllAssets);
WorkManager.RunInThread(o => ar.Execute(), null, string.Format("AssetsRequest ({0})", m_scene.Name));
ar.Execute();
}
else
{

View File

@@ -218,7 +218,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// {
try
{
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService);
InventoryArchiveWriteRequest iarReq = new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream);
iarReq.Execute(options, UserAccountService);
}
catch (EntryPointNotFoundException e)
{
@@ -261,7 +262,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// {
try
{
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService);
InventoryArchiveWriteRequest iarReq = new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath);
iarReq.Execute(options, UserAccountService);
}
catch (EntryPointNotFoundException e)
{

View File

@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
Dictionary<UUID, Quaternion> originalRotations = new Dictionary<UUID, Quaternion>();
// this possible is not needed if keyframes are saved
Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>();
// Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>();
foreach (SceneObjectGroup objectGroup in objlist)
{
@@ -423,8 +423,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
objectGroup.RootPart.SetForce(Vector3.Zero);
objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false);
originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion;
objectGroup.RootPart.KeyframeMotion = null;
// originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion;
// objectGroup.RootPart.KeyframeMotion = null;
Vector3 inventoryStoredPosition = objectGroup.AbsolutePosition;
originalPositions[objectGroup.UUID] = inventoryStoredPosition;
@@ -476,7 +476,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
objectGroup.RootPart.RotationOffset = originalRotations[objectGroup.UUID];
objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID];
// objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID];
if (objectGroup.RootPart.KeyframeMotion != null)
objectGroup.RootPart.KeyframeMotion.Resume();
}
@@ -989,11 +989,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// one full update during the attachment
// process causes some clients to fail to display the
// attachment properly.
m_Scene.AddNewSceneObject(group, true, false);
if (!attachment)
{
group.AbsolutePosition = pos + veclist[i];
m_Scene.AddNewSceneObject(group, true, false);
// Fire on_rez
group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1);
@@ -1001,6 +1001,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
group.ScheduleGroupForFullUpdate();
}
else
m_Scene.AddNewSceneObject(group, true, false);
// m_log.DebugFormat(
// "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",

View File

@@ -135,17 +135,13 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
m_reuseableDynamicTextures.Store(
GenerateReusableTextureKey(texture.InputCommands, texture.InputParams), newTextureID);
}
updater.newTextureID = newTextureID;
}
}
if (updater.UpdateTimer == 0)
{
lock (Updaters)
{
if (!Updaters.ContainsKey(updater.UpdaterID))
{
if (Updaters.ContainsKey(updater.UpdaterID))
Updaters.Remove(updater.UpdaterID);
}
}
}
}
@@ -172,21 +168,20 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
string extraParams, int updateTimer)
string extraParams)
{
return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, false, 255);
return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, false, 255);
}
public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
string extraParams, int updateTimer, bool SetBlending, byte AlphaValue)
string extraParams, bool SetBlending, byte AlphaValue)
{
return AddDynamicTextureURL(simID, primID, contentType, url,
extraParams, updateTimer, SetBlending,
(int)(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, SetBlending,
(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
}
public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
string extraParams, int updateTimer, bool SetBlending,
string extraParams, bool SetBlending,
int disp, byte AlphaValue, int face)
{
if (RenderPlugins.ContainsKey(contentType))
@@ -196,7 +191,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
updater.PrimID = primID;
updater.ContentType = contentType;
updater.Url = url;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = UUID.Random();
updater.Params = extraParams;
updater.BlendWithOldTexture = SetBlending;
@@ -213,26 +207,27 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
return updater.UpdaterID;
return updater.newTextureID;
}
return UUID.Zero;
}
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
string extraParams, int updateTimer)
string extraParams)
{
return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, false, 255);
return AddDynamicTextureData(simID, primID, contentType, data, extraParams, false,
(DISP_TEMP|DISP_EXPIRE), 255, ALL_SIDES);
}
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
string extraParams, int updateTimer, bool SetBlending, byte AlphaValue)
string extraParams, bool SetBlending, byte AlphaValue)
{
return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, SetBlending,
(int) (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
return AddDynamicTextureData(simID, primID, contentType, data, extraParams, SetBlending,
(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
}
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
string extraParams, bool SetBlending, int disp, byte AlphaValue, int face)
{
if (!RenderPlugins.ContainsKey(contentType))
return UUID.Zero;
@@ -258,7 +253,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
updater.PrimID = primID;
updater.ContentType = contentType;
updater.BodyData = data;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = UUID.Random();
updater.Params = extraParams;
updater.BlendWithOldTexture = SetBlending;
@@ -314,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
updater.UpdatePart(part, (UUID)objReusableTextureUUID);
}
return updater.UpdaterID;
return updater.newTextureID;
}
private string GenerateReusableTextureKey(string data, string extraParams)
@@ -404,17 +398,15 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public byte FrontAlpha = 255;
public string Params;
public UUID PrimID;
public bool SetNewFrontAlpha = false;
public UUID SimUUID;
public UUID UpdaterID;
public int UpdateTimer;
public int Face;
public int Disp;
public string Url;
public UUID newTextureID;
public DynamicTextureUpdater()
{
UpdateTimer = 0;
BodyData = null;
}
@@ -436,16 +428,23 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
// FIXME: Need to return the appropriate ID if only a single face is replaced.
oldID = tmptex.DefaultTexture.TextureID;
// not using parts number of faces because that fails on old meshs
if (Face == ALL_SIDES)
{
oldID = tmptex.DefaultTexture.TextureID;
tmptex.DefaultTexture.TextureID = textureID;
for(int i = 0; i < tmptex.FaceTextures.Length; i++)
{
if(tmptex.FaceTextures[i] != null)
tmptex.FaceTextures[i].TextureID = textureID;
}
}
else
{
try
{
Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
oldID = texface.TextureID;
texface.TextureID = textureID;
tmptex.FaceTextures[Face] = texface;
}
@@ -455,10 +454,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
}
// I'm pretty sure we always want to force this to true
// I'm pretty sure noone whats to set fullbright true if it wasn't true before.
// tmptex.DefaultTexture.Fullbright = true;
part.UpdateTextureEntry(tmptex.GetBytes());
}
@@ -491,13 +486,26 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
if (BlendWithOldTexture)
{
Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture;
if (defaultFace != null)
Primitive.TextureEntryFace curFace;
if(Face == ALL_SIDES)
curFace = part.Shape.Textures.DefaultTexture;
else
{
oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString());
try
{
curFace = part.Shape.Textures.GetFace((uint)Face);
}
catch
{
curFace = null;
}
}
if (curFace != null)
{
oldAsset = scene.AssetService.Get(curFace.TextureID.ToString());
if (oldAsset != null)
assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha);
assetData = BlendTextures(data, oldAsset.Data, FrontAlpha);
}
}
@@ -548,7 +556,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
return asset.FullID;
}
private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha)
private byte[] BlendTextures(byte[] frontImage, byte[] backImage, byte newAlpha)
{
ManagedImage managedImage;
Image image;
@@ -568,7 +576,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
Bitmap image2 = new Bitmap(image);
image.Dispose();
if (setNewAlpha)
if (newAlpha < 255)
SetAlpha(ref image1, newAlpha);
using(Bitmap joint = MergeBitMaps(image1, image2))

View File

@@ -379,9 +379,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
if (ThreadPool == null)
{
STPStartInfo startInfo = new STPStartInfo();
startInfo.IdleTimeout = 20000;
startInfo.IdleTimeout = 2000;
startInfo.MaxWorkerThreads = maxThreads;
startInfo.MinWorkerThreads = 1;
startInfo.MinWorkerThreads = 0;
startInfo.ThreadPriority = ThreadPriority.BelowNormal;
startInfo.StartSuspended = true;
startInfo.ThreadPoolName = "ScriptsHttpReq";

View File

@@ -77,8 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
"PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
"",
0);
"");
Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@@ -98,8 +97,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@@ -108,8 +106,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@@ -129,8 +126,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@@ -139,8 +135,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"alpha:250",
0);
"alpha:250");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@@ -161,8 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@@ -171,8 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@@ -191,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
"PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
"",
0);
"");
Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@@ -213,8 +205,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@@ -223,8 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@@ -253,8 +243,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"1024",
0);
"1024");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@@ -263,8 +252,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"1024",
0);
"1024");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@@ -284,8 +272,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@@ -294,8 +281,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"alpha:250",
0);
"alpha:250");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}
@@ -316,8 +302,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
@@ -326,8 +311,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
so.UUID,
m_vrm.GetContentType(),
dtText,
"",
0);
"");
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
}

View File

@@ -355,30 +355,22 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
lock (this)
{
if (alpha == 256)
bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
else
bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
graph = Graphics.FromImage(bitmap);
// this is really just to save people filling the
// background color in their scripts, only do when fully opaque
if (alpha >= 255)
{
bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
graph = Graphics.FromImage(bitmap);
using (SolidBrush bgFillBrush = new SolidBrush(bgColor))
{
graph.FillRectangle(bgFillBrush, 0, 0, width, height);
}
}
for (int w = 0; w < bitmap.Width; w++)
}
else
{
if (alpha <= 255)
bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
graph = Graphics.FromImage(bitmap);
Color newbg = Color.FromArgb(alpha,bgColor);
using (SolidBrush bgFillBrush = new SolidBrush(newbg))
{
for (int h = 0; h < bitmap.Height; h++)
{
bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h)));
}
graph.FillRectangle(bgFillBrush, 0, 0, width, height);
}
}
@@ -519,8 +511,32 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
// m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine);
if (nextLine.StartsWith("ResetTransf"))
{
graph.ResetTransform();
}
else if (nextLine.StartsWith("TransTransf"))
{
float x = 0;
float y = 0;
GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y);
graph.TranslateTransform(x, y);
}
else if (nextLine.StartsWith("ScaleTransf"))
{
float x = 0;
float y = 0;
GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y);
graph.ScaleTransform(x, y);
}
else if (nextLine.StartsWith("RotTransf"))
{
float x = 0;
GetParams(partsDelimiter, ref nextLine, 9, ref x);
graph.RotateTransform(x);
}
//replace with switch, or even better, do some proper parsing
if (nextLine.StartsWith("MoveTo"))
else if (nextLine.StartsWith("MoveTo"))
{
float x = 0;
float y = 0;
@@ -625,6 +641,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
startPoint.X += endPoint.X;
startPoint.Y += endPoint.Y;
}
else if (nextLine.StartsWith("FillEllipse"))
{
float x = 0;
float y = 0;
GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y);
endPoint.X = (int)x;
endPoint.Y = (int)y;
graph.FillEllipse(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
startPoint.X += endPoint.X;
startPoint.Y += endPoint.Y;
}
else if (nextLine.StartsWith("FontSize"))
{
nextLine = nextLine.Remove(0, 8);
@@ -790,6 +817,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
}
}
private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x)
{
line = line.Remove(0, startLength);
string[] parts = line.Split(partsDelimiter);
if (parts.Length > 0)
{
string xVal = parts[0].Trim();
x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture);
}
}
private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y)
{
line = line.Remove(0, startLength);

View File

@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
public void Process()
{
_finished = false;
httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue);
httpThread = WorkManager.StartThread(SendRequest, "XMLRPCreqThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue);
}
/*

View File

@@ -181,11 +181,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Archive the regions
Dictionary<UUID, sbyte> assetUuids = new Dictionary<UUID, sbyte>();
HashSet<UUID> failedIDs = new HashSet<UUID>();
HashSet<UUID> uncertainAssetsUUIDs = new HashSet<UUID>();
scenesGroup.ForEachScene(delegate(Scene scene)
{
string regionDir = MultiRegionFormat ? scenesGroup.GetRegionDir(scene.RegionInfo.RegionID) : "";
ArchiveOneRegion(scene, regionDir, assetUuids);
ArchiveOneRegion(scene, regionDir, assetUuids, failedIDs, uncertainAssetsUUIDs);
});
// Archive the assets
@@ -193,23 +195,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (SaveAssets)
{
m_log.DebugFormat("[ARCHIVER]: Saving {0} assets", assetUuids.Count);
// Asynchronously request all the assets required to perform this archive operation
AssetsRequest ar
= new AssetsRequest(
AssetsRequest ar = new AssetsRequest(
new AssetsArchiver(m_archiveWriter), assetUuids,
failedIDs.Count,
m_rootScene.AssetService, m_rootScene.UserAccountService,
m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets);
WorkManager.RunInThread(o => ar.Execute(), null, "Archive Assets Request");
// CloseArchive() will be called from ReceivedAllAssets()
m_rootScene.RegionInfo.ScopeID, options, null);
ar.Execute();
assetUuids = null;
}
else
{
m_log.DebugFormat("[ARCHIVER]: Not saving assets since --noassets was specified");
CloseArchive(string.Empty);
// CloseArchive(string.Empty);
}
CloseArchive(string.Empty);
}
catch (Exception e)
{
@@ -218,7 +218,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
}
private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids)
private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids,
HashSet<UUID> failedIDs, HashSet<UUID> uncertainAssetsUUIDs)
{
m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name);
@@ -237,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
SceneObjectGroup sceneObject = (SceneObjectGroup)entity;
if (!sceneObject.IsDeleted && !sceneObject.IsAttachment)
if (!sceneObject.IsDeleted && !sceneObject.IsAttachment && !sceneObject.IsTemporary && !sceneObject.inTransit)
{
if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule))
{
@@ -254,17 +255,39 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (SaveAssets)
{
UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids);
UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids, failedIDs, uncertainAssetsUUIDs);
int prevAssets = assetUuids.Count;
foreach (SceneObjectGroup sceneObject in sceneObjects)
{
int curErrorCntr = assetGatherer.ErrorCount;
int possible = assetGatherer.possibleNotAssetCount;
assetGatherer.AddForInspection(sceneObject);
assetGatherer.GatherAll();
curErrorCntr = assetGatherer.ErrorCount - curErrorCntr;
possible = assetGatherer.possibleNotAssetCount - possible;
if(curErrorCntr > 0)
{
m_log.ErrorFormat("[ARCHIVER]: object {0} '{1}', at {2}, contains {3} references to missing or damaged assets",
sceneObject.UUID, sceneObject.Name ,sceneObject.AbsolutePosition.ToString(), curErrorCntr);
if(possible > 0)
m_log.WarnFormat("[ARCHIVER Warning]: object also contains {0} references that may be to missing or damaged assets or not a problem", possible);
}
else if(possible > 0)
{
m_log.WarnFormat("[ARCHIVER Warning]: object {0} '{1}', at {2}, contains {3} references that may be to missing or damaged assets or not a problem",
sceneObject.UUID, sceneObject.Name ,sceneObject.AbsolutePosition.ToString(), possible);
}
}
assetGatherer.GatherAll();
int errors = assetGatherer.FailedUUIDs.Count;
m_log.DebugFormat(
"[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets",
sceneObjects.Count, assetUuids.Count - prevAssets);
"[ARCHIVER]: {0} region scene objects to save reference {1} possible assets",
sceneObjects.Count, assetUuids.Count - prevAssets + errors);
if(errors > 0)
m_log.DebugFormat("[ARCHIVER]: {0} of these have problems or are not assets and will be ignored", errors);
}
if (numObjectsSkippedPermissions > 0)
@@ -572,7 +595,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
foreach (SceneObjectGroup sceneObject in sceneObjects)
{
//m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
if(sceneObject.IsDeleted || sceneObject.inTransit)
continue;
string serializedObject = serializer.SerializeGroupToXml2(sceneObject, m_options);
string objectPath = string.Format("{0}{1}", regionDir, ArchiveHelpers.CreateObjectPath(sceneObject));
m_archiveWriter.WriteFile(objectPath, serializedObject);

View File

@@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <value>
/// Post a message to the log every x assets as a progress bar
/// </value>
protected static int LOG_ASSET_LOAD_NOTIFICATION_INTERVAL = 50;
protected static int LOG_ASSET_LOAD_NOTIFICATION_INTERVAL = 100;
/// <value>
/// Keep a count of the number of assets written so that we can provide status updates

View File

@@ -61,28 +61,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
Aborted
};
/// <value>
/// Timeout threshold if we still need assets or missing asset notifications but have stopped receiving them
/// from the asset service
/// </value>
protected const int TIMEOUT = 60 * 1000;
/// <value>
/// If a timeout does occur, limit the amount of UUID information put to the console.
/// </value>
protected const int MAX_UUID_DISPLAY_ON_TIMEOUT = 3;
protected System.Timers.Timer m_requestCallbackTimer;
/// <value>
/// State of this request
/// </value>
private RequestState m_requestState = RequestState.Initial;
/// <value>
/// uuids to request
/// </value>
protected IDictionary<UUID, sbyte> m_uuids;
private int m_previousErrorsCount;
/// <value>
/// Callback used when all the assets requested have been received.
@@ -104,6 +87,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// </value>
private int m_repliesRequired;
private System.Timers.Timer m_timeOutTimer;
private bool m_timeout;
/// <value>
/// Asset service used to request the assets
/// </value>
@@ -117,205 +103,98 @@ namespace OpenSim.Region.CoreModules.World.Archiver
protected internal AssetsRequest(
AssetsArchiver assetsArchiver, IDictionary<UUID, sbyte> uuids,
int previousErrorsCount,
IAssetService assetService, IUserAccountService userService,
UUID scope, Dictionary<string, object> options,
AssetsRequestCallback assetsRequestCallback)
{
m_assetsArchiver = assetsArchiver;
m_uuids = uuids;
m_previousErrorsCount = previousErrorsCount;
m_assetsRequestCallback = assetsRequestCallback;
m_assetService = assetService;
m_userAccountService = userService;
m_scopeID = scope;
m_options = options;
m_repliesRequired = uuids.Count;
// FIXME: This is a really poor way of handling the timeout since it will always leave the original requesting thread
// hanging. Need to restructure so an original request thread waits for a ManualResetEvent on asset received
// so we can properly abort that thread. Or request all assets synchronously, though that would be a more
// radical change
m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT);
m_requestCallbackTimer.AutoReset = false;
m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout);
}
protected internal void Execute()
{
m_requestState = RequestState.Running;
m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} possible assets", m_repliesRequired);
Culture.SetCurrentCulture();
// We can stop here if there are no assets to fetch
if (m_repliesRequired == 0)
{
m_requestState = RequestState.Completed;
PerformAssetsRequestCallback(false);
return;
}
m_requestCallbackTimer.Enabled = true;
m_timeOutTimer = new System.Timers.Timer(60000);
m_timeOutTimer .AutoReset = false;
m_timeOutTimer.Elapsed += OnTimeout;
m_timeout = false;
foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids)
{
// m_log.DebugFormat("[ARCHIVER]: Requesting asset {0}", kvp.Key);
// m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback);
AssetBase asset = m_assetService.Get(kvp.Key.ToString());
PreAssetRequestCallback(kvp.Key.ToString(), kvp.Value, asset);
}
}
protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args)
{
bool timedOut = true;
try
{
lock (this)
string thiskey = kvp.Key.ToString();
try
{
// Take care of the possibilty that this thread started but was paused just outside the lock before
// the final request came in (assuming that such a thing is possible)
if (m_requestState == RequestState.Completed)
{
timedOut = false;
return;
}
m_requestState = RequestState.Aborted;
}
// 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.Keys)
{
uuids.Add(uuid);
}
foreach (UUID uuid in m_foundAssetUuids)
{
uuids.Remove(uuid);
}
foreach (UUID uuid in m_notFoundAssetUuids)
{
uuids.Remove(uuid);
}
m_log.ErrorFormat(
"[ARCHIVER]: Asset service failed to return information about {0} requested assets", uuids.Count);
int i = 0;
foreach (UUID uuid in uuids)
{
m_log.ErrorFormat("[ARCHIVER]: No information about asset {0} received", uuid);
if (++i >= MAX_UUID_DISPLAY_ON_TIMEOUT)
m_timeOutTimer.Enabled = true;
AssetBase asset = m_assetService.Get(thiskey);
if(m_timeout)
break;
m_timeOutTimer.Enabled = false;
if(asset == null)
{
m_notFoundAssetUuids.Add(new UUID(thiskey));
continue;
}
sbyte assetType = kvp.Value;
if (asset != null && assetType == (sbyte)AssetType.Unknown)
{
m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", thiskey, SLUtil.AssetTypeFromCode(assetType));
asset.Type = assetType;
}
m_foundAssetUuids.Add(asset.FullID);
m_assetsArchiver.WriteAsset(PostProcess(asset));
}
if (uuids.Count > MAX_UUID_DISPLAY_ON_TIMEOUT)
m_log.ErrorFormat(
"[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT);
m_log.Error("[ARCHIVER]: Archive save aborted. PLEASE DO NOT USE THIS ARCHIVE, IT WILL BE INCOMPLETE.");
}
catch (Exception e)
{
m_log.ErrorFormat("[ARCHIVER]: Timeout handler exception {0}{1}", e.Message, e.StackTrace);
}
finally
{
if (timedOut)
WorkManager.RunInThread(PerformAssetsRequestCallback, true, "Archive Assets Request Callback");
}
}
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)
{
m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, SLUtil.AssetTypeFromCode((sbyte)assetType));
fetchedAsset.Type = (sbyte)assetType;
}
AssetRequestCallback(fetchedAssetID, this, fetchedAsset);
}
/// <summary>
/// Called back by the asset cache when it has the asset
/// </summary>
/// <param name="assetID"></param>
/// <param name="asset"></param>
public void AssetRequestCallback(string id, object sender, AssetBase asset)
{
Culture.SetCurrentCulture();
try
{
lock (this)
catch (Exception e)
{
//m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id);
m_requestCallbackTimer.Stop();
if ((m_requestState == RequestState.Aborted) || (m_requestState == RequestState.Completed))
{
m_log.WarnFormat(
"[ARCHIVER]: Received information about asset {0} while in state {1}. Ignoring.",
id, m_requestState);
return;
}
if (asset != null)
{
// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
m_foundAssetUuids.Add(asset.FullID);
m_assetsArchiver.WriteAsset(PostProcess(asset));
}
else
{
// m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id);
m_notFoundAssetUuids.Add(new UUID(id));
}
if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count >= m_repliesRequired)
{
m_requestState = RequestState.Completed;
if(m_notFoundAssetUuids.Count == 0)
m_log.DebugFormat(
"[ARCHIVER]: Successfully added {0} assets",
m_foundAssetUuids.Count);
else
m_log.DebugFormat(
"[ARCHIVER]: Successfully added {0} assets ({1} assets not found but these may be expected invalid references)",
m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);
// We want to stop using the asset cache thread asap
// as we now need to do the work of producing the rest of the archive
WorkManager.RunInThread(PerformAssetsRequestCallback, false, "Archive Assets Request Callback");
}
else
{
m_requestCallbackTimer.Start();
}
m_log.ErrorFormat("[ARCHIVER]: Execute failed with {0}", e);
}
}
catch (Exception e)
{
m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e);
}
m_timeOutTimer.Dispose();
int totalerrors = m_notFoundAssetUuids.Count + m_previousErrorsCount;
if(m_timeout)
m_log.DebugFormat("[ARCHIVER]: Aborted because AssetService request timeout. Successfully added {0} assets", m_foundAssetUuids.Count);
else if(totalerrors == 0)
m_log.DebugFormat("[ARCHIVER]: Successfully added all {0} assets", m_foundAssetUuids.Count);
else
m_log.DebugFormat("[ARCHIVER]: Successfully added {0} assets ({1} of total possible assets requested were not found, were damaged or were not assets)",
m_foundAssetUuids.Count, totalerrors);
PerformAssetsRequestCallback(m_timeout);
}
private void OnTimeout(object source, ElapsedEventArgs args)
{
m_timeout = true;
}
/// <summary>
/// Perform the callback on the original requester of the assets
/// </summary>
protected void PerformAssetsRequestCallback(object o)
private void PerformAssetsRequestCallback(object o)
{
if(m_assetsRequestCallback == null)
return;
Culture.SetCurrentCulture();
Boolean timedOut = (Boolean)o;
@@ -331,7 +210,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
}
protected AssetBase PostProcess(AssetBase asset)
private AssetBase PostProcess(AssetBase asset)
{
if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home"))
{

View File

@@ -176,6 +176,14 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
public void SendParcelsOverlay(IClientAPI client)
{
if (m_landManagementModule != null)
{
m_landManagementModule.SendParcelOverlay(client);
}
}
public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
{
if (m_landManagementModule != null)