aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs6
-rw-r--r--OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs66
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs165
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGIncomingSceneObjectEngine.cs344
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs215
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/HGAssetMapperTests.cs85
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
42 files changed, 857 insertions, 109 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 5cdcab9..47dcbcd 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
167 167
168 // Do Decode! 168 // Do Decode!
169 if (decode) 169 if (decode)
170 Util.FireAndForget(delegate { Decode(assetID, j2kData); }); 170 Util.FireAndForget(delegate { Decode(assetID, j2kData); }, null, "J2KDecoderModule.BeginDecode");
171 } 171 }
172 } 172 }
173 173
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 9d6870f..fe9a17d 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -302,7 +302,7 @@ namespace OpenSim.Region.CoreModules.Asset
302 } 302 }
303 303
304 Util.FireAndForget( 304 Util.FireAndForget(
305 delegate { WriteFileCache(filename, asset); }); 305 delegate { WriteFileCache(filename, asset); }, null, "FlotsamAssetCache.UpdateFileCache");
306 } 306 }
307 } 307 }
308 catch (Exception e) 308 catch (Exception e)
@@ -964,11 +964,11 @@ namespace OpenSim.Region.CoreModules.Asset
964 case "assets": 964 case "assets":
965 con.Output("Ensuring assets are cached for all scenes."); 965 con.Output("Ensuring assets are cached for all scenes.");
966 966
967 Watchdog.RunInThread(delegate 967 WorkManager.RunInThread(delegate
968 { 968 {
969 int assetReferenceTotal = TouchAllSceneAssets(true); 969 int assetReferenceTotal = TouchAllSceneAssets(true);
970 con.OutputFormat("Completed check with {0} assets.", assetReferenceTotal); 970 con.OutputFormat("Completed check with {0} assets.", assetReferenceTotal);
971 }, "TouchAllSceneAssets", null); 971 }, null, "TouchAllSceneAssets");
972 972
973 break; 973 break;
974 974
diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
index fd02b08..73e4431 100644
--- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
+++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
@@ -39,7 +39,6 @@ using OpenSim.Framework;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization; 40using OpenSim.Region.Framework.Scenes.Serialization;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 42
44namespace OpenSim.Region.CoreModules.Asset.Tests 43namespace OpenSim.Region.CoreModules.Asset.Tests
45{ 44{
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 3bd7bee..5fb995b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -53,7 +53,6 @@ using OpenSim.Region.ScriptEngine.Interfaces;
53using OpenSim.Region.ScriptEngine.XEngine; 53using OpenSim.Region.ScriptEngine.XEngine;
54using OpenSim.Services.Interfaces; 54using OpenSim.Services.Interfaces;
55using OpenSim.Tests.Common; 55using OpenSim.Tests.Common;
56using OpenSim.Tests.Common.Mock;
57 56
58namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests 57namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
59{ 58{
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index d8c159f..ea7481d 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -593,7 +593,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
593 593
594 if (sendTime < now) 594 if (sendTime < now)
595 { 595 {
596 Util.FireAndForget(o => SendAppearance(avatarID)); 596 Util.FireAndForget(o => SendAppearance(avatarID), null, "AvatarFactoryModule.SendAppearance");
597 m_sendqueue.Remove(avatarID); 597 m_sendqueue.Remove(avatarID);
598 } 598 }
599 } 599 }
@@ -611,7 +611,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
611 611
612 if (sendTime < now) 612 if (sendTime < now)
613 { 613 {
614 Util.FireAndForget(o => SaveAppearance(avatarID)); 614 Util.FireAndForget(o => SaveAppearance(avatarID), null, "AvatarFactoryModule.SaveAppearance");
615 m_savequeue.Remove(avatarID); 615 m_savequeue.Remove(avatarID);
616 } 616 }
617 } 617 }
@@ -1038,7 +1038,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
1038 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); 1038 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
1039 else 1039 else
1040 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); 1040 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId);
1041 }); 1041 }, null, "AvatarFactoryModule.OnClientRequestWearables");
1042 } 1042 }
1043 1043
1044 /// <summary> 1044 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index de014ba..9513408 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -34,7 +34,6 @@ using OpenSim.Framework;
34using OpenSim.Region.CoreModules.Asset; 34using OpenSim.Region.CoreModules.Asset;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38 37
39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 38namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
40{ 39{
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
index 5725d67..5e35135 100644
--- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -187,7 +187,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
187 { 187 {
188 rc.Request(reqStream, m_Auth); 188 rc.Request(reqStream, m_Auth);
189 m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", data.Length, agentId); 189 m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", data.Length, agentId);
190 } 190 }, null, "XBakesModule.Store"
191 ); 191 );
192 } 192 }
193 } 193 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs
index 7b8c418..3018d94 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs
@@ -41,7 +41,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
43using OpenSim.Tests.Common; 43using OpenSim.Tests.Common;
44using OpenSim.Tests.Common.Mock;
45 44
46namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests 45namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests
47{ 46{
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 31bcded..7ab568e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -511,7 +511,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
511 511
512 // Notify about this user status 512 // Notify about this user status
513 StatusNotify(friendList, agentID, online); 513 StatusNotify(friendList, agentID, online);
514 } 514 }, null, "FriendsModule.StatusChange"
515 ); 515 );
516 } 516 }
517 } 517 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index be12935..27b7376 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -660,7 +660,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
660 FriendsService.Delete(friendUUI, agentID.ToString()); 660 FriendsService.Delete(friendUUI, agentID.ToString());
661 661
662 // notify the exfriend's service 662 // notify the exfriend's service
663 Util.FireAndForget(delegate { Delete(exfriendID, agentID, friendUUI); }); 663 Util.FireAndForget(
664 delegate { Delete(exfriendID, agentID, friendUUI); }, null, "HGFriendsModule.DeleteFriendshipForeignFriend");
664 665
665 m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentID, friendUUI); 666 m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentID, friendUUI);
666 return true; 667 return true;
@@ -678,7 +679,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
678 FriendsService.Delete(agentUUI, exfriendID.ToString()); 679 FriendsService.Delete(agentUUI, exfriendID.ToString());
679 680
680 // notify the agent's service? 681 // notify the agent's service?
681 Util.FireAndForget(delegate { Delete(agentID, exfriendID, agentUUI); }); 682 Util.FireAndForget(
683 delegate { Delete(agentID, exfriendID, agentUUI); }, null, "HGFriendsModule.DeleteFriendshipLocalFriend");
682 684
683 m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentUUI, exfriendID); 685 m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentUUI, exfriendID);
684 return true; 686 return true;
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
index 961117e..e6fd54e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
@@ -35,7 +35,6 @@ using OpenSim.Framework;
35using OpenSim.Region.CoreModules.Avatar.Friends; 35using OpenSim.Region.CoreModules.Avatar.Friends;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock;
39 38
40namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests 39namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
41{ 40{
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 6f3c80a..a1b918a 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
213 HandleUndeliverableMessage(im, result); 213 HandleUndeliverableMessage(im, result);
214 else 214 else
215 result(success); 215 result(success);
216 }); 216 }, null, "HGMessageTransferModule.SendInstantMessage");
217 217
218 return; 218 return;
219 } 219 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 9fb8aa5..6dab227 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -431,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
431 m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, 431 m_scene.UserAccountService, m_scene.RegionInfo.ScopeID,
432 options, ReceivedAllAssets); 432 options, ReceivedAllAssets);
433 433
434 Watchdog.RunInThread(o => ar.Execute(), string.Format("AssetsRequest ({0})", m_scene.Name), null); 434 WorkManager.RunInThread(o => ar.Execute(), null, string.Format("AssetsRequest ({0})", m_scene.Name));
435 } 435 }
436 else 436 else
437 { 437 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
index 8d7de14..84f9f3f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
49{ 48{
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
index 3f16a16..d5f3a22 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
49{ 48{
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
index 4791a79..b614c18 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
49{ 48{
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
index e2d95da..4b015d7 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
49{ 48{
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
index 162a0c3..d615cce 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
@@ -39,7 +39,6 @@ using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 42
44namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests 43namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
45{ 44{
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 8337a2f..546a121 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -194,7 +194,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
194 Util.FireAndForget(delegate 194 Util.FireAndForget(delegate
195 { 195 {
196 GetImageAssets(((IScenePresence)obj).UUID); 196 GetImageAssets(((IScenePresence)obj).UUID);
197 }); 197 }, null, "UserProfileModule.GetImageAssets");
198 } 198 }
199 199
200 /// <summary> 200 /// <summary>
@@ -921,8 +921,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
921 object Pref = (object)pref; 921 object Pref = (object)pref;
922 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString())) 922 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString()))
923 { 923 {
924 m_log.InfoFormat("[PROFILES]: UserPreferences request error"); 924// m_log.InfoFormat("[PROFILES]: UserPreferences request error");
925 remoteClient.SendAgentAlertMessage("Error requesting preferences", false); 925// remoteClient.SendAgentAlertMessage("Error requesting preferences", false);
926 return; 926 return;
927 } 927 }
928 pref = (UserPreferences) Pref; 928 pref = (UserPreferences) Pref;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index c43633c..09e8204 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -804,8 +804,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
804 // once we reach here... 804 // once we reach here...
805 //avatar.Scene.RemoveCapsHandler(avatar.UUID); 805 //avatar.Scene.RemoveCapsHandler(avatar.UUID);
806 806
807 string capsPath = String.Empty;
808
809 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 807 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
810 AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); 808 AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo();
811 agentCircuit.startpos = position; 809 agentCircuit.startpos = position;
@@ -2702,5 +2700,69 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2702 } 2700 }
2703 #endregion 2701 #endregion
2704 2702
2703 public virtual bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
2704 {
2705 // If the user is banned, we won't let any of their objects
2706 // enter. Period.
2707 //
2708 if (Scene.RegionInfo.EstateSettings.IsBanned(so.OwnerID))
2709 {
2710 m_log.DebugFormat(
2711 "[ENTITY TRANSFER MODULE]: Denied prim crossing of {0} {1} into {2} for banned avatar {3}",
2712 so.Name, so.UUID, Scene.Name, so.OwnerID);
2713
2714 return false;
2715 }
2716
2717 if (newPosition != Vector3.Zero)
2718 so.RootPart.GroupPosition = newPosition;
2719
2720 if (!Scene.AddSceneObject(so))
2721 {
2722 m_log.DebugFormat(
2723 "[ENTITY TRANSFER MODULE]: Problem adding scene object {0} {1} into {2} ",
2724 so.Name, so.UUID, Scene.Name);
2725
2726 return false;
2727 }
2728
2729 if (!so.IsAttachment)
2730 {
2731 // FIXME: It would be better to never add the scene object at all rather than add it and then delete
2732 // it
2733 if (!Scene.Permissions.CanObjectEntry(so.UUID, true, so.AbsolutePosition))
2734 {
2735 // Deny non attachments based on parcel settings
2736 //
2737 m_log.Info("[ENTITY TRANSFER MODULE]: Denied prim crossing because of parcel settings");
2738
2739 Scene.DeleteSceneObject(so, false);
2740
2741 return false;
2742 }
2743
2744 // For attachments, we need to wait until the agent is root
2745 // before we restart the scripts, or else some functions won't work.
2746 so.RootPart.ParentGroup.CreateScriptInstances(
2747 0, false, Scene.DefaultScriptEngine, GetStateSource(so));
2748
2749 so.ResumeScripts();
2750
2751 if (so.RootPart.KeyframeMotion != null)
2752 so.RootPart.KeyframeMotion.UpdateSceneObject(so);
2753 }
2754
2755 return true;
2756 }
2757
2758 private int GetStateSource(SceneObjectGroup sog)
2759 {
2760 ScenePresence sp = Scene.GetScenePresence(sog.OwnerID);
2761
2762 if (sp != null)
2763 return sp.GetStateSource();
2764
2765 return 2; // StateSource.PrimCrossing
2766 }
2705 } 2767 }
2706} 2768}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 0c0cdf2..97267c1 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -110,6 +110,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
110 } 110 }
111 } 111 }
112 112
113 /// <summary>
114 /// Used for processing analysis of incoming attachments in a controlled fashion.
115 /// </summary>
116 private HGIncomingSceneObjectEngine m_incomingSceneObjectEngine;
117
113 #region ISharedRegionModule 118 #region ISharedRegionModule
114 119
115 public override string Name 120 public override string Name
@@ -153,33 +158,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
153 if (m_Enabled) 158 if (m_Enabled)
154 { 159 {
155 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); 160 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
156 scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; 161 //scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
157 }
158 }
159 162
160 void OnIncomingSceneObject(SceneObjectGroup so) 163 m_incomingSceneObjectEngine = new HGIncomingSceneObjectEngine(scene.Name);
161 { 164 m_incomingSceneObjectEngine.Start();
162 if (!so.IsAttachment)
163 return;
164
165 if (so.AttachedAvatar == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar))
166 return;
167
168 // foreign user
169 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar);
170 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
171 {
172 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
173 {
174 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
175 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url);
176 Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
177 HGUuidGatherer uuidGatherer = new HGUuidGatherer(Scene.AssetService, url);
178 uuidGatherer.GatherAssetUuids(so, ids);
179
180 foreach (KeyValuePair<UUID, sbyte> kvp in ids)
181 uuidGatherer.FetchAsset(kvp.Key);
182 }
183 } 165 }
184 } 166 }
185 167
@@ -209,12 +191,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
209 base.RemoveRegion(scene); 191 base.RemoveRegion(scene);
210 192
211 if (m_Enabled) 193 if (m_Enabled)
194 {
212 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); 195 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);
196 m_incomingSceneObjectEngine.Stop();
197 }
213 } 198 }
214 199
215 #endregion 200 #endregion
216 201
217 #region HG overrides of IEntiryTransferModule 202 #region HG overrides of IEntityTransferModule
218 203
219 protected override GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message) 204 protected override GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message)
220 { 205 {
@@ -561,6 +546,132 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
561 } 546 }
562 } 547 }
563 548
549 private void RemoveIncomingSceneObjectJobs(string commonIdToRemove)
550 {
551 List<Job> jobsToReinsert = new List<Job>();
552 int jobsRemoved = 0;
553
554 Job job;
555 while ((job = m_incomingSceneObjectEngine.RemoveNextRequest()) != null)
556 {
557 if (job.CommonId != commonIdToRemove)
558 jobsToReinsert.Add(job);
559 else
560 jobsRemoved++;
561 }
562
563 m_log.DebugFormat(
564 "[HG ENTITY TRANSFER]: Removing {0} jobs with common ID {1} and reinserting {2} other jobs",
565 jobsRemoved, commonIdToRemove, jobsToReinsert.Count);
566
567 if (jobsToReinsert.Count > 0)
568 {
569 foreach (Job jobToReinsert in jobsToReinsert)
570 m_incomingSceneObjectEngine.QueueRequest(jobToReinsert);
571 }
572 }
573
574 public override bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
575 {
576 // FIXME: We must make it so that we can use SOG.IsAttachment here. At the moment it is always null!
577 if (!so.IsAttachmentCheckFull())
578 return base.HandleIncomingSceneObject(so, newPosition);
579
580 // Equally, we can't use so.AttachedAvatar here.
581 if (so.OwnerID == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.OwnerID))
582 return base.HandleIncomingSceneObject(so, newPosition);
583
584 // foreign user
585 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.OwnerID);
586 if (aCircuit != null)
587 {
588 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) == 0)
589 {
590 // We have already pulled the necessary attachments from the source grid.
591 base.HandleIncomingSceneObject(so, newPosition);
592 }
593 else
594 {
595 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
596 {
597 m_incomingSceneObjectEngine.QueueRequest(
598 string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name),
599 so.OwnerID.ToString(),
600 o =>
601 {
602 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
603 // m_log.DebugFormat(
604 // "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}",
605 // so.Name, so.AttachedAvatar, url);
606
607 IteratingHGUuidGatherer uuidGatherer = new IteratingHGUuidGatherer(Scene.AssetService, url);
608 uuidGatherer.RecordAssetUuids(so);
609
610 while (!uuidGatherer.Complete)
611 {
612 int tickStart = Util.EnvironmentTickCount();
613
614 UUID? nextUuid = uuidGatherer.NextUuidToInspect;
615 uuidGatherer.GatherNext();
616
617 // m_log.DebugFormat(
618 // "[HG ENTITY TRANSFER]: Gathered attachment asset uuid {0} for object {1} for HG user {2} took {3} ms with asset service {4}",
619 // nextUuid, so.Name, so.OwnerID, Util.EnvironmentTickCountSubtract(tickStart), url);
620
621 int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart);
622
623 if (ticksElapsed > 30000)
624 {
625 m_log.WarnFormat(
626 "[HG ENTITY TRANSFER]: Removing incoming scene object jobs for HG user {0} as gather of {1} from {2} took {3} ms to respond (> {4} ms)",
627 so.OwnerID, so.Name, url, ticksElapsed, 30000);
628
629 RemoveIncomingSceneObjectJobs(so.OwnerID.ToString());
630
631 return;
632 }
633 }
634
635 IDictionary<UUID, sbyte> ids = uuidGatherer.GetGatheredUuids();
636
637 // m_log.DebugFormat(
638 // "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}",
639 // ids.Count, so.Name, so.OwnerID, url);
640
641 foreach (KeyValuePair<UUID, sbyte> kvp in ids)
642 {
643 int tickStart = Util.EnvironmentTickCount();
644
645 uuidGatherer.FetchAsset(kvp.Key);
646
647 int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart);
648
649 if (ticksElapsed > 30000)
650 {
651 m_log.WarnFormat(
652 "[HG ENTITY TRANSFER]: Removing incoming scene object jobs for HG user {0} as fetch of {1} from {2} took {3} ms to respond (> {4} ms)",
653 so.OwnerID, kvp.Key, url, ticksElapsed, 30000);
654
655 RemoveIncomingSceneObjectJobs(so.OwnerID.ToString());
656
657 return;
658 }
659 }
660
661 base.HandleIncomingSceneObject(so, newPosition);
662
663 // m_log.DebugFormat(
664 // "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}",
665 // so.Name, so.OwnerID, url);
666 },
667 null);
668 }
669 }
670 }
671
672 return true;
673 }
674
564 #endregion 675 #endregion
565 676
566 #region IUserAgentVerificationModule 677 #region IUserAgentVerificationModule
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGIncomingSceneObjectEngine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGIncomingSceneObjectEngine.cs
new file mode 100644
index 0000000..f62e7f4
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGIncomingSceneObjectEngine.cs
@@ -0,0 +1,344 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Concurrent;
30using System.Reflection;
31using System.Threading;
32using log4net;
33using OpenSim.Framework;
34using OpenSim.Framework.Monitoring;
35using OpenSim.Region.Framework.Scenes;
36
37namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
38{
39 public class Job
40 {
41 public string Name { get; private set; }
42 public string CommonId { get; private set; }
43 public WaitCallback Callback { get; private set; }
44 public object O { get; private set; }
45
46 public Job(string name, string commonId, WaitCallback callback, object o)
47 {
48 Name = name;
49 CommonId = commonId;
50 Callback = callback;
51 O = o;
52 }
53 }
54
55 // TODO: These kinds of classes MUST be generalized with JobEngine, etc.
56 public class HGIncomingSceneObjectEngine
57 {
58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59
60 public int LogLevel { get; set; }
61
62 public bool IsRunning { get; private set; }
63
64 public string Name { get; set; }
65
66 /// <summary>
67 /// The timeout in milliseconds to wait for at least one event to be written when the recorder is stopping.
68 /// </summary>
69 public int RequestProcessTimeoutOnStop { get; set; }
70
71 /// <summary>
72 /// Controls whether we need to warn in the log about exceeding the max queue size.
73 /// </summary>
74 /// <remarks>
75 /// This is flipped to false once queue max has been exceeded and back to true when it falls below max, in
76 /// order to avoid spamming the log with lots of warnings.
77 /// </remarks>
78 private bool m_warnOverMaxQueue = true;
79
80 private BlockingCollection<Job> m_requestQueue;
81
82 private CancellationTokenSource m_cancelSource = new CancellationTokenSource();
83
84 private Stat m_requestsWaitingStat;
85
86 private Job m_currentJob;
87
88 /// <summary>
89 /// Used to signal that we are ready to complete stop.
90 /// </summary>
91 private ManualResetEvent m_finishedProcessingAfterStop = new ManualResetEvent(false);
92
93 public HGIncomingSceneObjectEngine(string name)
94 {
95// LogLevel = 1;
96 Name = name;
97 RequestProcessTimeoutOnStop = 5000;
98
99// MainConsole.Instance.Commands.AddCommand(
100// "Debug",
101// false,
102// "debug jobengine",
103// "debug jobengine <start|stop|status>",
104// "Start, stop or get status of the job engine.",
105// "If stopped then all jobs are processed immediately.",
106// HandleControlCommand);
107 }
108
109 public void Start()
110 {
111 lock (this)
112 {
113 if (IsRunning)
114 return;
115
116 IsRunning = true;
117
118 m_finishedProcessingAfterStop.Reset();
119
120 m_requestQueue = new BlockingCollection<Job>(new ConcurrentQueue<Job>(), 5000);
121
122 m_requestsWaitingStat =
123 new Stat(
124 "HGIncomingAttachmentsWaiting",
125 "Number of incoming attachments waiting for processing.",
126 "",
127 "",
128 "entitytransfer",
129 Name,
130 StatType.Pull,
131 MeasuresOfInterest.None,
132 stat => stat.Value = m_requestQueue.Count,
133 StatVerbosity.Debug);
134
135 StatsManager.RegisterStat(m_requestsWaitingStat);
136
137 WorkManager.StartThread(
138 ProcessRequests,
139 string.Format("HG Incoming Scene Object Engine Thread ({0})", Name),
140 ThreadPriority.Normal,
141 false,
142 true,
143 null,
144 int.MaxValue);
145 }
146 }
147
148 public void Stop()
149 {
150 lock (this)
151 {
152 try
153 {
154 if (!IsRunning)
155 return;
156
157 IsRunning = false;
158
159 int requestsLeft = m_requestQueue.Count;
160
161 if (requestsLeft <= 0)
162 {
163 m_cancelSource.Cancel();
164 }
165 else
166 {
167 m_log.InfoFormat("[HG INCOMING SCENE OBJECT ENGINE]: Waiting to write {0} events after stop.", requestsLeft);
168
169 while (requestsLeft > 0)
170 {
171 if (!m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop))
172 {
173 // After timeout no events have been written
174 if (requestsLeft == m_requestQueue.Count)
175 {
176 m_log.WarnFormat(
177 "[HG INCOMING SCENE OBJECT ENGINE]: No requests processed after {0} ms wait. Discarding remaining {1} requests",
178 RequestProcessTimeoutOnStop, requestsLeft);
179
180 break;
181 }
182 }
183
184 requestsLeft = m_requestQueue.Count;
185 }
186 }
187 }
188 finally
189 {
190 m_cancelSource.Dispose();
191 StatsManager.DeregisterStat(m_requestsWaitingStat);
192 m_requestsWaitingStat = null;
193 m_requestQueue = null;
194 }
195 }
196 }
197
198 public Job RemoveNextRequest()
199 {
200 Job nextRequest;
201 m_requestQueue.TryTake(out nextRequest);
202
203 return nextRequest;
204 }
205
206 public bool QueueRequest(string name, string commonId, WaitCallback req, object o)
207 {
208 return QueueRequest(new Job(name, commonId, req, o));
209 }
210
211 public bool QueueRequest(Job job)
212 {
213 if (LogLevel >= 1)
214 m_log.DebugFormat(
215 "[HG INCOMING SCENE OBJECT ENGINE]: Queued job {0}, common ID {1}", job.Name, job.CommonId);
216
217 if (m_requestQueue.Count < m_requestQueue.BoundedCapacity)
218 {
219 // m_log.DebugFormat(
220 // "[OUTGOING QUEUE REFILL ENGINE]: Adding request for categories {0} for {1} in {2}",
221 // categories, client.AgentID, m_udpServer.Scene.Name);
222
223 m_requestQueue.Add(job);
224
225 if (!m_warnOverMaxQueue)
226 m_warnOverMaxQueue = true;
227
228 return true;
229 }
230 else
231 {
232 if (m_warnOverMaxQueue)
233 {
234 // m_log.WarnFormat(
235 // "[JOB ENGINE]: Request queue at maximum capacity, not recording request from {0} in {1}",
236 // client.AgentID, m_udpServer.Scene.Name);
237
238 m_log.WarnFormat("[HG INCOMING SCENE OBJECT ENGINE]: Request queue at maximum capacity, not recording job");
239
240 m_warnOverMaxQueue = false;
241 }
242
243 return false;
244 }
245 }
246
247 private void ProcessRequests()
248 {
249 try
250 {
251 while (IsRunning || m_requestQueue.Count > 0)
252 {
253 m_currentJob = m_requestQueue.Take(m_cancelSource.Token);
254
255 // QueueEmpty callback = req.Client.OnQueueEmpty;
256 //
257 // if (callback != null)
258 // {
259 // try
260 // {
261 // callback(req.Categories);
262 // }
263 // catch (Exception e)
264 // {
265 // m_log.Error("[OUTGOING QUEUE REFILL ENGINE]: ProcessRequests(" + req.Categories + ") threw an exception: " + e.Message, e);
266 // }
267 // }
268
269 if (LogLevel >= 1)
270 m_log.DebugFormat("[HG INCOMING SCENE OBJECT ENGINE]: Processing job {0}", m_currentJob.Name);
271
272 try
273 {
274 m_currentJob.Callback.Invoke(m_currentJob.O);
275 }
276 catch (Exception e)
277 {
278 m_log.Error(
279 string.Format(
280 "[HG INCOMING SCENE OBJECT ENGINE]: Job {0} failed, continuing. Exception ", m_currentJob.Name), e);
281 }
282
283 if (LogLevel >= 1)
284 m_log.DebugFormat("[HG INCOMING SCENE OBJECT ENGINE]: Processed job {0}", m_currentJob.Name);
285
286 m_currentJob = null;
287 }
288 }
289 catch (OperationCanceledException)
290 {
291 }
292
293 m_finishedProcessingAfterStop.Set();
294 }
295
296// private void HandleControlCommand(string module, string[] args)
297// {
298// // if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
299// // return;
300//
301// if (args.Length < 3)
302// {
303// MainConsole.Instance.Output("Usage: debug jobengine <stop|start|status|loglevel>");
304// return;
305// }
306//
307// string subCommand = args[2];
308//
309// if (subCommand == "stop")
310// {
311// Stop();
312// MainConsole.Instance.OutputFormat("Stopped job engine.");
313// }
314// else if (subCommand == "start")
315// {
316// Start();
317// MainConsole.Instance.OutputFormat("Started job engine.");
318// }
319// else if (subCommand == "status")
320// {
321// MainConsole.Instance.OutputFormat("Job engine running: {0}", IsRunning);
322// MainConsole.Instance.OutputFormat("Current job {0}", m_currentJob != null ? m_currentJob.Name : "none");
323// MainConsole.Instance.OutputFormat(
324// "Jobs waiting: {0}", IsRunning ? m_requestQueue.Count.ToString() : "n/a");
325// MainConsole.Instance.OutputFormat("Log Level: {0}", LogLevel);
326// }
327//
328// else if (subCommand == "loglevel")
329// {
330// // int logLevel;
331// int logLevel = int.Parse(args[3]);
332// // if (ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out logLevel))
333// // {
334// LogLevel = logLevel;
335// MainConsole.Instance.OutputFormat("Set log level to {0}", LogLevel);
336// // }
337// }
338// else
339// {
340// MainConsole.Instance.OutputFormat("Unrecognized job engine subcommand {0}", subCommand);
341// }
342// }
343 }
344}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index 04615a9..2ac1517 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -189,50 +189,203 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
189 return Utils.StringToBytes(RewriteSOP(xml)); 189 return Utils.StringToBytes(RewriteSOP(xml));
190 } 190 }
191 191
192 protected string RewriteSOP(string xml) 192 protected void TransformXml(XmlReader reader, XmlWriter writer)
193 { 193 {
194 XmlDocument doc = new XmlDocument(); 194// m_log.DebugFormat("[HG ASSET MAPPER]: Transforming XML");
195 doc.LoadXml(xml);
196 XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
197 195
198 foreach (XmlNode sop in sops) 196 int sopDepth = -1;
197 UserAccount creator = null;
198 bool hasCreatorData = false;
199
200 while (reader.Read())
199 { 201 {
200 UserAccount creator = null; 202 //Console.WriteLine("Depth: {0}", reader.Depth);
201 bool hasCreatorData = false; 203
202 XmlNodeList nodes = sop.ChildNodes; 204 switch (reader.NodeType)
203 foreach (XmlNode node in nodes)
204 { 205 {
205 if (node.Name == "CreatorID") 206 case XmlNodeType.Attribute:
207 writer.WriteAttributeString(reader.Prefix, reader.Name, reader.NamespaceURI, reader.Value);
208 break;
209
210 case XmlNodeType.CDATA:
211 writer.WriteCData(reader.Value);
212 break;
213
214 case XmlNodeType.Comment:
215 writer.WriteComment(reader.Value);
216 break;
217
218 case XmlNodeType.DocumentType:
219 writer.WriteDocType(reader.Name, reader.Value, null, null);
220 break;
221
222 case XmlNodeType.Element:
223// m_log.DebugFormat("Depth {0} at element {1}", reader.Depth, reader.Name);
224
225 writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
226
227 if (reader.LocalName == "SceneObjectPart")
206 { 228 {
207 UUID uuid = UUID.Zero; 229 if (sopDepth < 0)
208 UUID.TryParse(node.InnerText, out uuid); 230 {
209 creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid); 231 sopDepth = reader.Depth;
232// m_log.DebugFormat("[HG ASSET MAPPER]: Set sopDepth to {0}", sopDepth);
233 }
234 }
235 else
236 {
237 if (sopDepth >= 0 && reader.Depth == sopDepth + 1)
238 {
239 if (reader.Name == "CreatorID")
240 {
241 reader.Read();
242 if (reader.NodeType == XmlNodeType.Element && reader.Name == "Guid" || reader.Name == "UUID")
243 {
244 reader.Read();
245
246 if (reader.NodeType == XmlNodeType.Text)
247 {
248 UUID uuid = UUID.Zero;
249 UUID.TryParse(reader.Value, out uuid);
250 creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
251 writer.WriteElementString("UUID", reader.Value);
252 reader.Read();
253 }
254 else
255 {
256 // If we unexpected run across mixed content in this node, still carry on
257 // transforming the subtree (this replicates earlier behaviour).
258 TransformXml(reader, writer);
259 }
260 }
261 else
262 {
263 // If we unexpected run across mixed content in this node, still carry on
264 // transforming the subtree (this replicates earlier behaviour).
265 TransformXml(reader, writer);
266 }
267 }
268 else if (reader.Name == "CreatorData")
269 {
270 reader.Read();
271 if (reader.NodeType == XmlNodeType.Text)
272 {
273 hasCreatorData = true;
274 writer.WriteString(reader.Value);
275 }
276 else
277 {
278 // If we unexpected run across mixed content in this node, still carry on
279 // transforming the subtree (this replicates earlier behaviour).
280 TransformXml(reader, writer);
281 }
282 }
283 }
284 }
285
286 if (reader.IsEmptyElement)
287 {
288// m_log.DebugFormat("[HG ASSET MAPPER]: Writing end for empty element {0}", reader.Name);
289 writer.WriteEndElement();
210 } 290 }
211 if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
212 hasCreatorData = true;
213
214 //if (node.Name == "OwnerID")
215 //{
216 // UserAccount owner = GetUser(node.InnerText);
217 // if (owner != null)
218 // node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName;
219 //}
220 }
221 291
222 if (!hasCreatorData && creator != null) 292 break;
223 { 293
224 XmlElement creatorData = doc.CreateElement("CreatorData"); 294 case XmlNodeType.EndElement:
225 creatorData.InnerText = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName; 295// m_log.DebugFormat("Depth {0} at EndElement", reader.Depth);
226 sop.AppendChild(creatorData); 296 if (sopDepth == reader.Depth)
297 {
298 if (!hasCreatorData && creator != null)
299 writer.WriteElementString(reader.Prefix, "CreatorData", reader.NamespaceURI, string.Format("{0};{1} {2}", m_HomeURI, creator.FirstName, creator.LastName));
300
301// m_log.DebugFormat("[HG ASSET MAPPER]: Reset sopDepth");
302 sopDepth = -1;
303 creator = null;
304 hasCreatorData = false;
305 }
306 writer.WriteEndElement();
307 break;
308
309 case XmlNodeType.EntityReference:
310 writer.WriteEntityRef(reader.Name);
311 break;
312
313 case XmlNodeType.ProcessingInstruction:
314 writer.WriteProcessingInstruction(reader.Name, reader.Value);
315 break;
316
317 case XmlNodeType.Text:
318 writer.WriteString(reader.Value);
319 break;
320
321 default:
322 m_log.WarnFormat("[HG ASSET MAPPER]: Unrecognized node in asset XML transform in {0}", m_scene.Name);
323 break;
227 } 324 }
228 } 325 }
326 }
327
328 protected string RewriteSOP(string xmlData)
329 {
330// Console.WriteLine("Input XML [{0}]", xmlData);
229 331
230 using (StringWriter wr = new StringWriter()) 332 using (StringWriter sw = new StringWriter())
333 using (XmlTextWriter writer = new XmlTextWriter(sw))
334 using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
335 using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
231 { 336 {
232 doc.Save(wr); 337 TransformXml(reader, writer);
233 return wr.ToString(); 338
339 writer.WriteEndDocument();
340
341// Console.WriteLine("Output: [{0}]", sw.ToString());
342
343 return sw.ToString();
234 } 344 }
235 345
346 // We are now taking the more complex streaming approach above because some assets can be very large
347 // and can trigger higher CPU use or possibly memory problems.
348// XmlDocument doc = new XmlDocument();
349// doc.LoadXml(xml);
350// XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
351//
352// foreach (XmlNode sop in sops)
353// {
354// UserAccount creator = null;
355// bool hasCreatorData = false;
356// XmlNodeList nodes = sop.ChildNodes;
357// foreach (XmlNode node in nodes)
358// {
359// if (node.Name == "CreatorID")
360// {
361// UUID uuid = UUID.Zero;
362// UUID.TryParse(node.InnerText, out uuid);
363// creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
364// }
365// if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
366// hasCreatorData = true;
367//
368// //if (node.Name == "OwnerID")
369// //{
370// // UserAccount owner = GetUser(node.InnerText);
371// // if (owner != null)
372// // node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName;
373// //}
374// }
375//
376// if (!hasCreatorData && creator != null)
377// {
378// XmlElement creatorData = doc.CreateElement("CreatorData");
379// creatorData.InnerText = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
380// sop.AppendChild(creatorData);
381// }
382// }
383//
384// using (StringWriter wr = new StringWriter())
385// {
386// doc.Save(wr);
387// return wr.ToString();
388// }
236 } 389 }
237 390
238 // TODO: unused 391 // TODO: unused
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/HGAssetMapperTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/HGAssetMapperTests.cs
new file mode 100644
index 0000000..779da43
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/HGAssetMapperTests.cs
@@ -0,0 +1,85 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Xml;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.CoreModules.Framework.InventoryAccess;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Services.Interfaces;
36using OpenSim.Tests.Common;
37
38namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
39{
40 [TestFixture]
41 public class HGAssetMapperTests : OpenSimTestCase
42 {
43 [Test]
44 public void TestPostAssetRewrite()
45 {
46 TestHelpers.InMethod();
47// TestHelpers.EnableLogging();
48
49 string homeUrl = "http://hg.HomeTestPostAssetRewriteGrid.com";
50 string foreignUrl = "http://hg.ForeignTestPostAssetRewriteGrid.com";
51 UUID assetId = TestHelpers.ParseTail(0x1);
52 UUID userId = TestHelpers.ParseTail(0x10);
53 string userFirstName = "TestPostAsset";
54 string userLastName = "Rewrite";
55 int soPartsCount = 3;
56
57 Scene scene = new SceneHelpers().SetupScene();
58 HGAssetMapper hgam = new HGAssetMapper(scene, homeUrl);
59 UserAccount ua
60 = UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "password");
61
62 //AssetBase ncAssetSet = AssetHelpers.CreateNotecardAsset(assetId, "TestPostAssetRewriteNotecard");
63 SceneObjectGroup so = SceneHelpers.CreateSceneObject(soPartsCount, ua.PrincipalID);
64 AssetBase ncAssetSet = AssetHelpers.CreateAsset(assetId, so);
65 ncAssetSet.CreatorID = foreignUrl;
66 hgam.PostAsset(foreignUrl, ncAssetSet);
67
68 AssetBase ncAssetGet = scene.AssetService.Get(assetId.ToString());
69 Assert.AreEqual(foreignUrl, ncAssetGet.CreatorID);
70 string xmlData = Utils.BytesToString(ncAssetGet.Data);
71 XmlDocument ncAssetGetXmlDoc = new XmlDocument();
72 ncAssetGetXmlDoc.LoadXml(xmlData);
73 XmlNodeList creatorDataNodes = ncAssetGetXmlDoc.GetElementsByTagName("CreatorData");
74
75 Assert.AreEqual(soPartsCount, creatorDataNodes.Count);
76 //Console.WriteLine("creatorDataNodes {0}", creatorDataNodes.Count);
77
78 foreach (XmlNode creatorDataNode in creatorDataNodes)
79 {
80 Assert.AreEqual(
81 string.Format("{0};{1} {2}", homeUrl, ua.FirstName, ua.LastName), creatorDataNode.InnerText);
82 }
83 }
84 }
85} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index 80b9c0a..c64ab44 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization; 44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48 47
49namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests 48namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
50{ 49{
diff --git a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
index a70261e..3abacbd 100644
--- a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Framework
67 m_timer.Elapsed += ProcessQueue; 67 m_timer.Elapsed += ProcessQueue;
68 m_timer.Start(); 68 m_timer.Start();
69 69
70 //Watchdog.StartThread( 70 //WorkManager.StartThread(
71 // ProcessQueue, 71 // ProcessQueue,
72 // "GridServiceRequestThread", 72 // "GridServiceRequestThread",
73 // ThreadPriority.BelowNormal, 73 // ThreadPriority.BelowNormal,
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs
index 9d36aa5..4e3b7e5 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs
@@ -32,7 +32,6 @@ using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.CoreModules.Framework.UserManagement; 33using OpenSim.Region.CoreModules.Framework.UserManagement;
34using OpenSim.Tests.Common; 34using OpenSim.Tests.Common;
35using OpenSim.Tests.Common.Mock;
36 35
37namespace OpenSim.Region.CoreModules.Framework.UserManagement.Tests 36namespace OpenSim.Region.CoreModules.Framework.UserManagement.Tests
38{ 37{
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs
index e812d81..4d8b591 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs
@@ -41,7 +41,6 @@ using OpenSim.Framework;
41using OpenSim.Region.CoreModules.Scripting.HttpRequest; 41using OpenSim.Region.CoreModules.Scripting.HttpRequest;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Tests.Common; 43using OpenSim.Tests.Common;
44using OpenSim.Tests.Common.Mock;
45 44
46namespace OpenSim.Region.CoreModules.Scripting.HttpRequest.Tests 45namespace OpenSim.Region.CoreModules.Scripting.HttpRequest.Tests
47{ 46{
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
index 7119137..ed255bf 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
@@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.Scripting.VectorRender;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Scenes.Serialization; 41using OpenSim.Region.Framework.Scenes.Serialization;
42using OpenSim.Tests.Common; 42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44 43
45namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests 44namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
46{ 45{
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index d7ea906..af3700b 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
658 public void Process() 658 public void Process()
659 { 659 {
660 _finished = false; 660 _finished = false;
661 Watchdog.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false); 661 WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false);
662 } 662 }
663 663
664 /* 664 /*
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index 38862ca..7fcfc74 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -69,6 +69,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
69 get { return "HGAssetBroker"; } 69 get { return "HGAssetBroker"; }
70 } 70 }
71 71
72 public HGAssetBroker() {}
73
74 public HGAssetBroker(IConfigSource config)
75 {
76 Initialise(config);
77 }
78
72 public void Initialise(IConfigSource source) 79 public void Initialise(IConfigSource source)
73 { 80 {
74 IConfig moduleConfig = source.Configs["Modules"]; 81 IConfig moduleConfig = source.Configs["Modules"];
@@ -288,7 +295,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
288 295
289 if (asset != null) 296 if (asset != null)
290 { 297 {
291 Util.FireAndForget(delegate { handler(id, sender, asset); }); 298 Util.FireAndForget(delegate { handler(id, sender, asset); }, null, "HGAssetBroker.GotFromCache");
292 return true; 299 return true;
293 } 300 }
294 301
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 97b7559..5f34450 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -236,7 +236,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
236 236
237 if (asset != null) 237 if (asset != null)
238 { 238 {
239 Util.FireAndForget(delegate { handler(id, sender, asset); }); 239 Util.FireAndForget(
240 o => handler(id, sender, asset), null, "LocalAssetServiceConnector.GotFromCacheCallback");
240 return true; 241 return true;
241 } 242 }
242 } 243 }
@@ -249,7 +250,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
249// if (null == a) 250// if (null == a)
250// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id); 251// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
251 252
252 Util.FireAndForget(delegate { handler(assetID, s, a); }); 253 Util.FireAndForget(
254 o => handler(assetID, s, a), null, "LocalAssetServiceConnector.GotFromServiceCallback");
253 }); 255 });
254 } 256 }
255 257
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 8e995db..4661c21 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -198,8 +198,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
198 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 198 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
199 { 199 {
200 GridRegion region = null; 200 GridRegion region = null;
201 uint regionX = Util.WorldToRegionLoc((uint)x); 201// uint regionX = Util.WorldToRegionLoc((uint)x);
202 uint regionY = Util.WorldToRegionLoc((uint)y); 202// uint regionY = Util.WorldToRegionLoc((uint)y);
203 203
204 // First see if it's a neighbour, even if it isn't on this sim. 204 // First see if it's a neighbour, even if it isn't on this sim.
205 // Neighbour data is cached in memory, so this is fast 205 // Neighbour data is cached in memory, so this is fast
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 470ef02..cbe0e37 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -184,12 +184,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
184 // Protect ourselves against the caller subsequently modifying the items list 184 // Protect ourselves against the caller subsequently modifying the items list
185 List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); 185 List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items);
186 186
187 Watchdog.RunInThread(delegate 187 WorkManager.RunInThread(delegate
188 { 188 {
189 foreach (InventoryItemBase item in items) 189 foreach (InventoryItemBase item in items)
190 if (!string.IsNullOrEmpty(item.CreatorData)) 190 if (!string.IsNullOrEmpty(item.CreatorData))
191 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); 191 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData);
192 }, string.Format("GetFolderContent (user {0}, folder {1})", userID, folderID), null); 192 }, null, string.Format("GetFolderContent (user {0}, folder {1})", userID, folderID));
193 } 193 }
194 194
195 return invCol; 195 return invCol;
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 3e0c9f3..9c6706f 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -372,7 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
372 // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so 372 // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so
373 // that users can enter the scene. If we allow the scripts to start in the loop above 373 // that users can enter the scene. If we allow the scripts to start in the loop above
374 // then they significantly increase the time until the OAR finishes loading. 374 // then they significantly increase the time until the OAR finishes loading.
375 Watchdog.RunInThread(o => 375 WorkManager.RunInThread(o =>
376 { 376 {
377 Thread.Sleep(15000); 377 Thread.Sleep(15000);
378 m_log.Info("[ARCHIVER]: Starting scripts in scene objects"); 378 m_log.Info("[ARCHIVER]: Starting scripts in scene objects");
@@ -387,7 +387,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
387 387
388 sceneContext.SceneObjects.Clear(); 388 sceneContext.SceneObjects.Clear();
389 } 389 }
390 }, string.Format("ReadArchiveStartScripts (request {0})", m_requestId), null); 390 }, null, string.Format("ReadArchiveStartScripts (request {0})", m_requestId));
391 391
392 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); 392 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
393 393
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
index 924b999..b7d7c26 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
200 m_rootScene.AssetService, m_rootScene.UserAccountService, 200 m_rootScene.AssetService, m_rootScene.UserAccountService,
201 m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets); 201 m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets);
202 202
203 Watchdog.RunInThread(o => ar.Execute(), "Archive Assets Request", null); 203 WorkManager.RunInThread(o => ar.Execute(), null, "Archive Assets Request");
204 204
205 // CloseArchive() will be called from ReceivedAllAssets() 205 // CloseArchive() will be called from ReceivedAllAssets()
206 } 206 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index ec39bc0..4d99a6e 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
227 finally 227 finally
228 { 228 {
229 if (timedOut) 229 if (timedOut)
230 Watchdog.RunInThread(PerformAssetsRequestCallback, "Archive Assets Request Callback", true); 230 WorkManager.RunInThread(PerformAssetsRequestCallback, true, "Archive Assets Request Callback");
231 } 231 }
232 } 232 }
233 233
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
296 296
297 // We want to stop using the asset cache thread asap 297 // We want to stop using the asset cache thread asap
298 // as we now need to do the work of producing the rest of the archive 298 // as we now need to do the work of producing the rest of the archive
299 Watchdog.RunInThread(PerformAssetsRequestCallback, "Archive Assets Request Callback", false); 299 WorkManager.RunInThread(PerformAssetsRequestCallback, false, "Archive Assets Request Callback");
300 } 300 }
301 else 301 else
302 { 302 {
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index b31257d..9f197f5 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Framework.Scenes.Serialization; 45using OpenSim.Region.Framework.Scenes.Serialization;
46using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; 46using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; 48using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
50using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; 49using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
51using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; 50using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs
index 6d0253d..4ed67f3 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs
@@ -31,7 +31,6 @@ using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Tests.Common; 33using OpenSim.Tests.Common;
34using OpenSim.Tests.Common.Mock;
35 34
36namespace OpenSim.Region.CoreModules.World.Land.Tests 35namespace OpenSim.Region.CoreModules.World.Land.Tests
37{ 36{
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 0945b43..949acb6 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -36,7 +36,6 @@ using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
40 39
41namespace OpenSim.Region.CoreModules.World.Land.Tests 40namespace OpenSim.Region.CoreModules.World.Land.Tests
42{ 41{
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
index 03a96a4..ee57aed 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
@@ -39,7 +39,6 @@ using OpenSim.Region.CoreModules.World.Media.Moap;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization; 40using OpenSim.Region.Framework.Scenes.Serialization;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 42
44namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests 43namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
45{ 44{
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 78fbefe..767f75f 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -381,7 +381,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
381 381
382// m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); 382// m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread");
383 383
384 Watchdog.StartThread( 384 WorkManager.StartThread(
385 process, 385 process,
386 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), 386 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
387 ThreadPriority.BelowNormal, 387 ThreadPriority.BelowNormal,