From 231a3bf147315a9284140476d2b09e13c3fee1c0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 May 2012 01:45:49 +0100 Subject: Implement optional name and description on http stream handlers so that we can relate a slow request to what the handler actually does and the agent it serves, if applicable. This is most useful for capabilities where the url is not self-describing. --- .../FetchInventory2ServerConnector.cs | 3 +- .../Handlers/GetMesh/GetMeshServerConnector.cs | 15 ++-- .../Handlers/GetTexture/GetTextureHandler.cs | 4 +- .../GetTexture/GetTextureServerConnector.cs | 6 +- .../GetTexture/Tests/GetTextureHandlerTests.cs | 2 +- .../UploadBakedTextureHandler.cs | 4 +- .../WebFetchInvDescServerConnector.cs | 8 +- OpenSim/Capabilities/LLSDStreamHandler.cs | 6 +- .../Servers/HttpServer/BaseHTTPHandler.cs | 10 +-- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 16 +++- .../Servers/HttpServer/BaseRequestHandler.cs | 10 ++- .../Servers/HttpServer/BaseStreamHandler.cs | 9 ++- .../Servers/HttpServer/BinaryStreamHandler.cs | 17 ++-- .../HttpServer/Interfaces/IStreamHandler.cs | 21 ++++- .../Servers/HttpServer/RestDeserialiseHandler.cs | 6 +- .../Servers/HttpServer/RestHTTPHandler.cs | 20 +++-- .../Servers/HttpServer/RestStreamHandler.cs | 14 ++-- OpenSim/Region/Application/OpenSimBase.cs | 11 ++- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 47 ++++++++--- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 8 +- .../Linden/Caps/FetchInventory2Module.cs | 3 +- .../ClientStack/Linden/Caps/GetMeshModule.cs | 12 +-- .../ClientStack/Linden/Caps/GetTextureModule.cs | 4 +- .../Linden/Caps/MeshUploadFlagModule.cs | 4 +- .../NewFileAgentInventoryVariablePriceModule.cs | 93 ++++++++++++---------- .../Linden/Caps/ObjectCaps/ObjectAdd.cs | 14 ++-- .../Caps/ObjectCaps/UploadObjectAssetModule.cs | 15 ++-- .../Linden/Caps/SimulatorFeaturesModule.cs | 4 +- .../Linden/Caps/UploadBakedTextureModule.cs | 4 +- .../Linden/Caps/WebFetchInvDescModule.cs | 9 ++- .../CoreModules/World/Land/LandManagementModule.cs | 33 ++++---- .../CoreModules/World/Media/Moap/MoapModule.cs | 8 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 17 ++-- .../Region/Framework/Scenes/RegionStatsHandler.cs | 9 ++- .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 53 ++++++------ .../Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | 54 +++++++------ OpenSim/Region/UserStatistics/WebStatsModule.cs | 17 ++-- .../Handlers/Authentication/OpenIdServerHandler.cs | 2 + 38 files changed, 375 insertions(+), 217 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs index 0ba8931..5bab52f 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs @@ -63,7 +63,8 @@ namespace OpenSim.Capabilities.Handlers FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService); IRequestHandler reqHandler - = new RestStreamHandler("POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest); + = new RestStreamHandler( + "POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null); server.AddStreamHandler(reqHandler); } } diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs index 2ecfa3c..8a275f3 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs @@ -66,13 +66,14 @@ namespace OpenSim.Capabilities.Handlers throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); - IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), - delegate(Hashtable m_dhttpMethod) - { - return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null); - }); + IRequestHandler reqHandler + = new RestHTTPHandler( + "GET", + "/CAPS/" + UUID.Random(), + httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null), + "GetMesh", + null); server.AddStreamHandler(reqHandler); } - } -} +} \ No newline at end of file diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 217217e..abdbc72 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs @@ -58,8 +58,8 @@ namespace OpenSim.Capabilities.Handlers // TODO: Change this to a config option const string REDIRECT_URL = null; - public GetTextureHandler(string path, IAssetService assService) : - base("GET", path) + public GetTextureHandler(string path, IAssetService assService, string name, string description) + : base("GET", path, name, description) { m_assetService = assService; } diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs index 0d072f7..71cf033 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs @@ -62,8 +62,8 @@ namespace OpenSim.Capabilities.Handlers if (m_AssetService == null) throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); - server.AddStreamHandler(new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService)); + server.AddStreamHandler( + new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null)); } - } -} +} \ No newline at end of file diff --git a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs index 85e5cc6..761e4e7 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs @@ -52,7 +52,7 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests // Overkill - we only really need the asset service, not a whole scene. Scene scene = new SceneHelpers().SetupScene(); - GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService); + GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null); TestOSHttpRequest req = new TestOSHttpRequest(); TestOSHttpResponse resp = new TestOSHttpResponse(); req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012"); diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index 594ce9d..8849a59 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -85,8 +85,8 @@ namespace OpenSim.Capabilities.Handlers uploader.OnUpLoad += BakedTextureUploaded; m_HostCapsObj.HttpListener.AddStreamHandler( - new BinaryStreamHandler("POST", capsBase + uploaderPath, - uploader.uploaderCaps)); + new BinaryStreamHandler( + "POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null)); string protocol = "http://"; diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs index 92eeb14..5d86557 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs @@ -68,7 +68,13 @@ namespace OpenSim.Capabilities.Handlers ServerUtils.LoadPlugin(libService, args); WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); - IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest); + IRequestHandler reqHandler + = new RestStreamHandler( + "POST", + "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, + webFetchHandler.FetchInventoryDescendentsRequest, + "WebFetchInvDesc", + null); server.AddStreamHandler(reqHandler); } diff --git a/OpenSim/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs index c7c1fc9..f5c728c 100644 --- a/OpenSim/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Capabilities/LLSDStreamHandler.cs @@ -39,7 +39,11 @@ namespace OpenSim.Framework.Capabilities private LLSDMethod m_method; public LLSDStreamhandler(string httpMethod, string path, LLSDMethod method) - : base(httpMethod, path) + : this(httpMethod, path, method, null, null) {} + + public LLSDStreamhandler( + string httpMethod, string path, LLSDMethod method, string name, string description) + : base(httpMethod, path, name, description) { m_method = method; } diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHTTPHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseHTTPHandler.cs index 2fe9769..9f8f4a8 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHTTPHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHTTPHandler.cs @@ -33,9 +33,9 @@ namespace OpenSim.Framework.Servers.HttpServer { public abstract Hashtable Handle(string path, Hashtable Request); - protected BaseHTTPHandler(string httpMethod, string path) - : base(httpMethod, path) - { - } + protected BaseHTTPHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} + + protected BaseHTTPHandler(string httpMethod, string path, string name, string description) + : base(httpMethod, path, name, description) {} } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 0fbf90a..4ea4a1a 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -156,7 +156,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } - public List GetStreamHandlerKeys() + public List GetStreamHandlerKeys() { lock (m_streamHandlers) return new List(m_streamHandlers.Keys); @@ -410,6 +410,8 @@ namespace OpenSim.Framework.Servers.HttpServer // string reqnum = "unknown"; int tickstart = Environment.TickCount; + IRequestHandler requestHandler = null; + try { // OpenSim.Framework.WebUtil.OSHeaderRequestID @@ -438,8 +440,6 @@ namespace OpenSim.Framework.Servers.HttpServer //response.KeepAlive = true; response.SendChunked = false; - IRequestHandler requestHandler; - string path = request.RawUrl; string handlerKey = GetHandlerKey(request.HttpMethod, path); @@ -675,8 +675,16 @@ namespace OpenSim.Framework.Servers.HttpServer // since its just for reporting, tickdiff limit can be adjusted int tickdiff = Environment.TickCount - tickstart; if (tickdiff > 3000) + { m_log.InfoFormat( - "[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff); + "[BASE HTTP SERVER]: slow {0} for {1} {2} {3} from {4} took {5} ms", + requestMethod, + uriString, + requestHandler != null ? requestHandler.Name : "", + requestHandler != null ? requestHandler.Description : "", + request.RemoteIPEndPoint.ToString(), + tickdiff); + } } } diff --git a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs index a2135a3..ae7aaf2 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs @@ -45,8 +45,16 @@ namespace OpenSim.Framework.Servers.HttpServer private readonly string m_path; - protected BaseRequestHandler(string httpMethod, string path) + public string Name { get; private set; } + + public string Description { get; private set; } + + protected BaseRequestHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} + + protected BaseRequestHandler(string httpMethod, string path, string name, string description) { + Name = name; + Description = description; m_httpMethod = httpMethod; m_path = path; } diff --git a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs index f1cde74..6342983 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs @@ -34,8 +34,9 @@ namespace OpenSim.Framework.Servers.HttpServer public abstract byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse); - protected BaseStreamHandler(string httpMethod, string path) : base(httpMethod, path) - { - } + protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} + + protected BaseStreamHandler(string httpMethod, string path, string name, string description) + : base(httpMethod, path, name, description) {} } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs index 1699233..b94bfb4 100644 --- a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs @@ -36,6 +36,15 @@ namespace OpenSim.Framework.Servers.HttpServer { private BinaryMethod m_method; + public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) + : this(httpMethod, path, binaryMethod, null, null) {} + + public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod, string name, string description) + : base(httpMethod, path, name, description) + { + m_method = binaryMethod; + } + public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { byte[] data = ReadFully(request); @@ -45,12 +54,6 @@ namespace OpenSim.Framework.Servers.HttpServer return Encoding.UTF8.GetBytes(responseString); } - public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) - : base(httpMethod, path) - { - m_method = binaryMethod; - } - private static byte[] ReadFully(Stream stream) { byte[] buffer = new byte[1024]; @@ -70,4 +73,4 @@ namespace OpenSim.Framework.Servers.HttpServer } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs index a449c2d..cb5cce5 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IStreamHandler.cs @@ -32,6 +32,25 @@ namespace OpenSim.Framework.Servers.HttpServer { public interface IRequestHandler { + + /// + /// Name for this handler. + /// + /// + /// Used for diagnostics. The path doesn't always describe what the handler does. Can be null if none + /// specified. + /// + string Name { get; } + + /// + /// Description for this handler. + /// + /// + /// Used for diagnostics. The path doesn't always describe what the handler does. Can be null if none + /// specified. + /// + string Description { get; } + // Return response content type string ContentType { get; } @@ -58,4 +77,4 @@ namespace OpenSim.Framework.Servers.HttpServer { Hashtable Handle(string path, Hashtable request); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs index a467a83..07082a8 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestDeserialiseHandler.cs @@ -39,7 +39,11 @@ namespace OpenSim.Framework.Servers.HttpServer private RestDeserialiseMethod m_method; public RestDeserialiseHandler(string httpMethod, string path, RestDeserialiseMethod method) - : base(httpMethod, path) + : this(httpMethod, path, method, null, null) {} + + public RestDeserialiseHandler( + string httpMethod, string path, RestDeserialiseMethod method, string name, string description) + : base(httpMethod, path, name, description) { m_method = method; } diff --git a/OpenSim/Framework/Servers/HttpServer/RestHTTPHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestHTTPHandler.cs index 1f23cac..7f89839 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestHTTPHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestHTTPHandler.cs @@ -38,19 +38,25 @@ namespace OpenSim.Framework.Servers.HttpServer get { return m_dhttpMethod; } } - public override Hashtable Handle(string path, Hashtable request) + public RestHTTPHandler(string httpMethod, string path, GenericHTTPMethod dhttpMethod) + : base(httpMethod, path) { + m_dhttpMethod = dhttpMethod; + } + + public RestHTTPHandler( + string httpMethod, string path, GenericHTTPMethod dhttpMethod, string name, string description) + : base(httpMethod, path, name, description) + { + m_dhttpMethod = dhttpMethod; + } + public override Hashtable Handle(string path, Hashtable request) + { string param = GetParam(path); request.Add("param", param); request.Add("path", path); return m_dhttpMethod(request); } - - public RestHTTPHandler(string httpMethod, string path, GenericHTTPMethod dhttpMethod) - : base(httpMethod, path) - { - m_dhttpMethod = dhttpMethod; - } } } diff --git a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs index d2c4002..1f17fee 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestStreamHandler.cs @@ -39,6 +39,15 @@ namespace OpenSim.Framework.Servers.HttpServer get { return m_restMethod; } } + public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) + : this(httpMethod, path, restMethod, null, null) {} + + public RestStreamHandler(string httpMethod, string path, RestMethod restMethod, string name, string description) + : base(httpMethod, path, name, description) + { + m_restMethod = restMethod; + } + public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { Encoding encoding = Encoding.UTF8; @@ -52,10 +61,5 @@ namespace OpenSim.Framework.Servers.HttpServer return Encoding.UTF8.GetBytes(responseString); } - - public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base(httpMethod, path) - { - m_restMethod = restMethod; - } } } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 5de3f25..79259d8 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -388,7 +388,7 @@ namespace OpenSim scene.LoadPrimsFromStorage(regionInfo.originRegionID); // TODO : Try setting resource for region xstats here on scene - MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); + MainServer.Instance.AddStreamHandler(new RegionStatsHandler(regionInfo)); scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID); scene.EventManager.TriggerParcelPrimCountUpdate(); @@ -773,6 +773,9 @@ namespace OpenSim return Util.UTF8.GetBytes("OK"); } + public string Name { get { return "SimStatus"; } } + public string Description { get { return "Simulator Status"; } } + public string ContentType { get { return "text/plain"; } @@ -797,6 +800,9 @@ namespace OpenSim { OpenSimBase m_opensim; string osXStatsURI = String.Empty; + + public string Name { get { return "XSimStatus"; } } + public string Description { get { return "Simulator XStatus"; } } public XSimStatusHandler(OpenSimBase sim) { @@ -837,6 +843,9 @@ namespace OpenSim { OpenSimBase m_opensim; string osUXStatsURI = String.Empty; + + public string Name { get { return "UXSimStatus"; } } + public string Description { get { return "Simulator UXStatus"; } } public UXSimStatusHandler(OpenSimBase sim) { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index e20c24f..9791885 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -155,7 +155,9 @@ namespace OpenSim.Region.ClientStack.Linden try { // the root of all evil - m_HostCapsObj.RegisterHandler("SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest)); + m_HostCapsObj.RegisterHandler( + "SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null)); + m_log.DebugFormat( "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID); @@ -163,7 +165,10 @@ namespace OpenSim.Region.ClientStack.Linden // new LLSDStreamhandler("POST", // capsBase + m_mapLayerPath, // GetMapLayer); - IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); + IRequestHandler req + = new RestStreamHandler( + "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); + m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); } @@ -178,14 +183,27 @@ namespace OpenSim.Region.ClientStack.Linden try { // I don't think this one works... - m_HostCapsObj.RegisterHandler("NewFileAgentInventory", new LLSDStreamhandler("POST", - capsBase + m_newInventory, - NewAgentInventoryRequest)); - IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory); + m_HostCapsObj.RegisterHandler( + "NewFileAgentInventory", + new LLSDStreamhandler( + "POST", + capsBase + m_newInventory, + NewAgentInventoryRequest, + "NewFileAgentInventory", + null)); + + IRequestHandler req + = new RestStreamHandler( + "POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null); + m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); - m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); + + m_HostCapsObj.RegisterHandler( + "CopyInventoryFromNotecard", + new RestStreamHandler( + "POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null)); // As of RC 1.22.9 of the Linden client this is // supported @@ -289,7 +307,9 @@ namespace OpenSim.Region.ClientStack.Linden m_dumpAssetsToFile); uploader.OnUpLoad += TaskScriptUpdated; - m_HostCapsObj.HttpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); + m_HostCapsObj.HttpListener.AddStreamHandler( + new BinaryStreamHandler( + "POST", capsBase + uploaderPath, uploader.uploaderCaps, "BunchOfCaps", null)); string protocol = "http://"; @@ -416,8 +436,14 @@ namespace OpenSim.Region.ClientStack.Linden AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); + m_HostCapsObj.HttpListener.AddStreamHandler( - new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); + new BinaryStreamHandler( + "POST", + capsBase + uploaderPath, + uploader.uploaderCaps, + "NewAgentInventoryRequest", + m_HostCapsObj.AgentID.ToString())); string protocol = "http://"; @@ -733,7 +759,8 @@ namespace OpenSim.Region.ClientStack.Linden uploader.OnUpLoad += ItemUpdated; m_HostCapsObj.HttpListener.AddStreamHandler( - new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); + new BinaryStreamHandler( + "POST", capsBase + uploaderPath, uploader.uploaderCaps, "NoteCardAgentInventory", null)); string protocol = "http://"; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 7c07c56..1a35d22 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -351,14 +351,18 @@ namespace OpenSim.Region.ClientStack.Linden // EventQueueGet when it receive capability information, but then we replace the rest handler immediately // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but // really it should be possible to directly register the poll handler as a capability. - caps.RegisterHandler("EventQueueGet", - new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/", null)); + caps.RegisterHandler( + "EventQueueGet", + new RestHTTPHandler( + "POST", capsBase + EventQueueGetUUID.ToString() + "/", null)); + // delegate(Hashtable m_dhttpMethod) // { // return ProcessQueue(m_dhttpMethod, agentID, caps); // })); // This will persist this beyond the expiry of the caps handlers + // TODO: Add EventQueueGet name/description for diagnostics MainServer.Instance.AddPollServiceHTTPHandler( capsBase + EventQueueGetUUID.ToString() + "/", new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs index 14501c7..cb5afcc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs @@ -132,7 +132,8 @@ namespace OpenSim.Region.ClientStack.Linden capUrl = "/CAPS/" + UUID.Random(); IRequestHandler reqHandler - = new RestStreamHandler("POST", capUrl, m_fetchHandler.FetchInventoryRequest); + = new RestStreamHandler( + "POST", capUrl, m_fetchHandler.FetchInventoryRequest, capName, agentID.ToString()); caps.RegisterHandler(capName, reqHandler); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index e7bd2e7..0d7b1fc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -120,11 +120,13 @@ namespace OpenSim.Region.ClientStack.Linden { // m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); - IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), - delegate(Hashtable m_dhttpMethod) - { - return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null); - }); + IRequestHandler reqHandler + = new RestHTTPHandler( + "GET", + "/CAPS/" + UUID.Random(), + httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null), + "GetMesh", + agentID.ToString()); caps.RegisterHandler("GetMesh", reqHandler); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index fffcee2..5ae9cc3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -130,7 +130,9 @@ namespace OpenSim.Region.ClientStack.Linden if (m_URL == "localhost") { // m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); - caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); + caps.RegisterHandler( + "GetTexture", + new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString())); } else { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs index 18c7eae..44a6883 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs @@ -117,7 +117,9 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { - IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag); + IRequestHandler reqHandler + = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag, "MeshUploadFlag", agentID.ToString()); + caps.RegisterHandler("MeshUploadFlag", reqHandler); m_agentID = agentID; } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 91872c5..52c4f44 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs @@ -115,67 +115,66 @@ namespace OpenSim.Region.ClientStack.Linden UUID capID = UUID.Random(); // m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); - caps.RegisterHandler("NewFileAgentInventoryVariablePrice", - - new LLSDStreamhandler("POST", - "/CAPS/" + capID.ToString(), - delegate(LLSDAssetUploadRequest req) - { - return NewAgentInventoryRequest(req,agentID); - })); - + caps.RegisterHandler( + "NewFileAgentInventoryVariablePrice", + new LLSDStreamhandler( + "POST", + "/CAPS/" + capID.ToString(), + req => NewAgentInventoryRequest(req, agentID), + "NewFileAgentInventoryVariablePrice", + agentID.ToString())); } #endregion public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) { - //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit - // You need to be aware of this and - + // you need to be aware of this //if (llsdRequest.asset_type == "texture" || // llsdRequest.asset_type == "animation" || // llsdRequest.asset_type == "sound") // { // check user level - ScenePresence avatar = null; - IClientAPI client = null; - m_scene.TryGetScenePresence(agentID, out avatar); - if (avatar != null) + ScenePresence avatar = null; + IClientAPI client = null; + m_scene.TryGetScenePresence(agentID, out avatar); + + if (avatar != null) + { + client = avatar.ControllingClient; + + if (avatar.UserLevel < m_levelUpload) { - client = avatar.ControllingClient; - - if (avatar.UserLevel < m_levelUpload) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); - - LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - errorResponse.rsvp = ""; - errorResponse.state = "error"; - return errorResponse; - } + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); + + LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + errorResponse.rsvp = ""; + errorResponse.state = "error"; + return errorResponse; } + } - // check funds - IMoneyModule mm = m_scene.RequestModuleInterface(); + // check funds + IMoneyModule mm = m_scene.RequestModuleInterface(); - if (mm != null) + if (mm != null) + { + if (!mm.UploadCovered(agentID, mm.UploadCharge)) { - if (!mm.UploadCovered(agentID, mm.UploadCharge)) - { - if (client != null) - client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); - - LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - errorResponse.rsvp = ""; - errorResponse.state = "error"; - return errorResponse; - } + if (client != null) + client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); + + LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); + errorResponse.rsvp = ""; + errorResponse.state = "error"; + return errorResponse; } + } + // } string assetName = llsdRequest.name; @@ -189,8 +188,14 @@ namespace OpenSim.Region.ClientStack.Linden AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); + MainServer.Instance.AddStreamHandler( - new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); + new BinaryStreamHandler( + "POST", + capsBase + uploaderPath, + uploader.uploaderCaps, + "NewFileAgentInventoryVariablePrice", + agentID.ToString())); string protocol = "http://"; @@ -199,10 +204,9 @@ namespace OpenSim.Region.ClientStack.Linden string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + uploaderPath; - + LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); - uploadResponse.rsvp = uploaderURL; uploadResponse.state = "upload"; @@ -220,6 +224,7 @@ namespace OpenSim.Region.ClientStack.Linden pinventoryItem, pparentFolder, pdata, pinventoryType, passetType,agentID); }; + return uploadResponse; } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs index 1c47f0e..4ccfc43 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs @@ -66,12 +66,14 @@ namespace OpenSim.Region.ClientStack.Linden // m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/"); - caps.RegisterHandler("ObjectAdd", - new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/", - delegate(Hashtable m_dhttpMethod) - { - return ProcessAdd(m_dhttpMethod, agentID, caps); - })); + caps.RegisterHandler( + "ObjectAdd", + new RestHTTPHandler( + "POST", + "/CAPS/OA/" + capuuid + "/", + httpMethod => ProcessAdd(httpMethod, agentID, caps), + "ObjectAdd", + agentID.ToString()));; } public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs index 7a3d97e..f0f3984 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs @@ -106,12 +106,15 @@ namespace OpenSim.Region.ClientStack.Linden UUID capID = UUID.Random(); // m_log.Debug("[UPLOAD OBJECT ASSET MODULE]: /CAPS/" + capID); - caps.RegisterHandler("UploadObjectAsset", - new RestHTTPHandler("POST", "/CAPS/OA/" + capID + "/", - delegate(Hashtable m_dhttpMethod) - { - return ProcessAdd(m_dhttpMethod, agentID, caps); - })); + caps.RegisterHandler( + "UploadObjectAsset", + new RestHTTPHandler( + "POST", + "/CAPS/OA/" + capID + "/", + httpMethod => ProcessAdd(httpMethod, agentID, caps), + "UploadObjectAsset", + agentID.ToString())); + /* caps.RegisterHandler("NewFileAgentInventoryVariablePrice", diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 1dd8938..8ed0fb3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -154,7 +154,9 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { IRequestHandler reqHandler - = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest); + = new RestHTTPHandler( + "GET", "/CAPS/" + UUID.Random(), + HandleSimulatorFeaturesRequest, "SimulatorFeatures", agentID.ToString()); caps.RegisterHandler("SimulatorFeatures", reqHandler); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 45d6071..b3d61a8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -106,7 +106,9 @@ namespace OpenSim.Region.ClientStack.Linden "POST", "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, new UploadBakedTextureHandler( - caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture)); + caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture, + "UploadBakedTexture", + agentID.ToString())); } } } \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 10f43d1..2359bd6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -144,7 +144,12 @@ namespace OpenSim.Region.ClientStack.Linden capUrl = "/CAPS/" + UUID.Random(); IRequestHandler reqHandler - = new RestStreamHandler("POST", capUrl, m_webFetchHandler.FetchInventoryDescendentsRequest); + = new RestStreamHandler( + "POST", + capUrl, + m_webFetchHandler.FetchInventoryDescendentsRequest, + "FetchInventoryDescendents2", + agentID.ToString()); caps.RegisterHandler(capName, reqHandler); } @@ -160,4 +165,4 @@ namespace OpenSim.Region.ClientStack.Linden // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index f6d4b40..8b7406d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1433,21 +1433,26 @@ namespace OpenSim.Region.CoreModules.World.Land private void EventManagerOnRegisterCaps(UUID agentID, Caps caps) { string capsBase = "/CAPS/" + caps.CapsObjectPath; - caps.RegisterHandler("RemoteParcelRequest", - new RestStreamHandler("POST", capsBase + remoteParcelRequestPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return RemoteParcelRequest(request, path, param, agentID, caps); - })); + caps.RegisterHandler( + "RemoteParcelRequest", + new RestStreamHandler( + "POST", + capsBase + remoteParcelRequestPath, + (request, path, param, httpRequest, httpResponse) + => RemoteParcelRequest(request, path, param, agentID, caps), + "RemoteParcelRequest", + agentID.ToString())); + UUID parcelCapID = UUID.Random(); - caps.RegisterHandler("ParcelPropertiesUpdate", - new RestStreamHandler("POST", "/CAPS/" + parcelCapID, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return ProcessPropertiesUpdate(request, path, param, agentID, caps); - })); + caps.RegisterHandler( + "ParcelPropertiesUpdate", + new RestStreamHandler( + "POST", + "/CAPS/" + parcelCapID, + (request, path, param, httpRequest, httpResponse) + => ProcessPropertiesUpdate(request, path, param, agentID, caps), + "ParcelPropertiesUpdate", + agentID.ToString())); } private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) { diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 5239f50..601e81e 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -145,7 +145,9 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap // Even though we're registering for POST we're going to get GETS and UPDATES too caps.RegisterHandler( - "ObjectMedia", new RestStreamHandler("POST", omCapUrl, HandleObjectMediaMessage)); + "ObjectMedia", + new RestStreamHandler( + "POST", omCapUrl, HandleObjectMediaMessage, "ObjectMedia", agentID.ToString())); } string omuCapUrl = "/CAPS/" + UUID.Random(); @@ -157,7 +159,9 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap // Even though we're registering for POST we're going to get GETS and UPDATES too caps.RegisterHandler( - "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); + "ObjectMediaNavigate", + new RestStreamHandler( + "POST", omuCapUrl, HandleObjectMediaNavigateMessage, "ObjectMediaNavigate", agentID.ToString())); } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index faaf928..2335bea 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -190,14 +190,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { //m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); string capsBase = "/CAPS/" + caps.CapsObjectPath; - caps.RegisterHandler("MapLayer", - new RestStreamHandler("POST", capsBase + m_mapLayerPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return MapLayerRequest(request, path, param, - agentID, caps); - })); + caps.RegisterHandler( + "MapLayer", + new RestStreamHandler( + "POST", + capsBase + m_mapLayerPath, + (request, path, param, httpRequest, httpResponse) + => MapLayerRequest(request, path, param, agentID, caps), + "MapLayer", + agentID.ToString())); } /// diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index 6c5685c..1365831 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs @@ -48,16 +48,19 @@ namespace OpenSim.Region.Framework.Scenes { public class RegionStatsHandler : IStreamedRequestHandler { + //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private string osRXStatsURI = String.Empty; private string osXStatsURI = String.Empty; //private string osSecret = String.Empty; private OpenSim.Framework.RegionInfo regionInfo; public string localZone = TimeZone.CurrentTimeZone.StandardName; public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); - - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public RegionStatsHandler(OpenSim.Framework.RegionInfo region_info) + public string Name { get { return "RegionStats"; } } + public string Description { get { return "Region Statistics"; } } + + public RegionStatsHandler(RegionInfo region_info) { regionInfo = region_info; osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret); diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 05678c0..be8873d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -306,30 +306,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice agentID, caps, scene.RegionInfo.RegionName); string capsBase = "/CAPS/" + caps.CapsObjectPath; - caps.RegisterHandler("ProvisionVoiceAccountRequest", - new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return ProvisionVoiceAccountRequest(scene, request, path, param, - agentID, caps); - })); - caps.RegisterHandler("ParcelVoiceInfoRequest", - new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return ParcelVoiceInfoRequest(scene, request, path, param, - agentID, caps); - })); - caps.RegisterHandler("ChatSessionRequest", - new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return ChatSessionRequest(scene, request, path, param, - agentID, caps); - })); + caps.RegisterHandler( + "ProvisionVoiceAccountRequest", + new RestStreamHandler( + "POST", + capsBase + m_provisionVoiceAccountRequestPath, + (request, path, param, httpRequest, httpResponse) + => ProvisionVoiceAccountRequest(scene, request, path, param, agentID, caps), + "ProvisionVoiceAccountRequest", + agentID.ToString())); + + caps.RegisterHandler( + "ParcelVoiceInfoRequest", + new RestStreamHandler( + "POST", + capsBase + m_parcelVoiceInfoRequestPath, + (request, path, param, httpRequest, httpResponse) + => ParcelVoiceInfoRequest(scene, request, path, param, agentID, caps), + "ParcelVoiceInfoRequest", + agentID.ToString())); + + caps.RegisterHandler( + "ChatSessionRequest", + new RestStreamHandler( + "POST", + capsBase + m_chatSessionRequestPath, + (request, path, param, httpRequest, httpResponse) + => ChatSessionRequest(scene, request, path, param, agentID, caps), + "ChatSessionRequest", + agentID.ToString())); } /// diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 738133c..a36fd74 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -406,30 +406,36 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice m_log.DebugFormat("[VivoxVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); string capsBase = "/CAPS/" + caps.CapsObjectPath; - caps.RegisterHandler("ProvisionVoiceAccountRequest", - new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return ProvisionVoiceAccountRequest(scene, request, path, param, - agentID, caps); - })); - caps.RegisterHandler("ParcelVoiceInfoRequest", - new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return ParcelVoiceInfoRequest(scene, request, path, param, - agentID, caps); - })); - caps.RegisterHandler("ChatSessionRequest", - new RestStreamHandler("POST", capsBase + m_chatSessionRequestPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return ChatSessionRequest(scene, request, path, param, - agentID, caps); - })); + + caps.RegisterHandler( + "ProvisionVoiceAccountRequest", + new RestStreamHandler( + "POST", + capsBase + m_provisionVoiceAccountRequestPath, + (request, path, param, httpRequest, httpResponse) + => ProvisionVoiceAccountRequest(scene, request, path, param, agentID, caps), + "ProvisionVoiceAccountRequest", + agentID.ToString())); + + caps.RegisterHandler( + "ParcelVoiceInfoRequest", + new RestStreamHandler( + "POST", + capsBase + m_parcelVoiceInfoRequestPath, + (request, path, param, httpRequest, httpResponse) + => ParcelVoiceInfoRequest(scene, request, path, param, agentID, caps), + "ParcelVoiceInfoRequest", + agentID.ToString())); + + caps.RegisterHandler( + "ChatSessionRequest", + new RestStreamHandler( + "POST", + capsBase + m_chatSessionRequestPath, + (request, path, param, httpRequest, httpResponse) + => ChatSessionRequest(scene, request, path, param, agentID, caps), + "ChatSessionRequest", + agentID.ToString())); } /// diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index 4248035..faf746f 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -282,14 +282,15 @@ namespace OpenSim.Region.UserStatistics // m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); string capsPath = "/CAPS/VS/" + UUID.Random(); - caps.RegisterHandler("ViewerStats", - new RestStreamHandler("POST", capsPath, - delegate(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - return ViewerStatsReport(request, path, param, - agentID, caps); - })); + caps.RegisterHandler( + "ViewerStats", + new RestStreamHandler( + "POST", + capsPath, + (request, path, param, httpRequest, httpResponse) + => ViewerStatsReport(request, path, param, agentID, caps), + "ViewerStats", + agentID.ToString())); } private void OnDeRegisterCaps(UUID agentID, Caps caps) diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs index dfed761..18cef15 100644 --- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs @@ -191,6 +191,8 @@ For more information, see http://openid.net/. #endregion HTML + public string Name { get { return "OpenId"; } } + public string Description { get { return null; } } public string ContentType { get { return m_contentType; } } public string HttpMethod { get { return m_httpMethod; } } public string Path { get { return m_path; } } -- cgit v1.1 From 9ffc2c106280a7b5b0eddba8cf906f1f7ad956a6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 May 2012 01:56:24 +0100 Subject: minor: resolve some mono compiler warnings --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 7 +------ .../ServiceConnectorsOut/Authorization/AuthorizationService.cs | 4 ++-- OpenSim/Region/DataSnapshot/DataRequestHandler.cs | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 8d5e0a5..e47c339 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1947,12 +1947,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Thread.Sleep(100); } - if (count > 0) - return true; - else - return false; - - return true; + return count > 0; } protected void SetInTransit(UUID id) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs index f0d21e6..4470799 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization MethodBase.GetCurrentMethod().DeclaringType); private IUserManagement m_UserManagement; - private IGridService m_GridService; +// private IGridService m_GridService; private Scene m_Scene; AccessFlags m_accessValue = AccessFlags.None; @@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization { m_Scene = scene; m_UserManagement = scene.RequestModuleInterface(); - m_GridService = scene.GridService; +// m_GridService = scene.GridService; if (config != null) { diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs index 2f2b3e6..32e93b4 100644 --- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs @@ -42,13 +42,13 @@ namespace OpenSim.Region.DataSnapshot { public class DataRequestHandler { - private Scene m_scene = null; +// private Scene m_scene = null; private DataSnapshotManager m_externalData = null; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public DataRequestHandler(Scene scene, DataSnapshotManager externalData) { - m_scene = scene; +// m_scene = scene; m_externalData = externalData; //Register HTTP handler -- cgit v1.1 From bf5f8b54ae24c50e7288d34525962ec174d4b473 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 May 2012 02:22:06 +0100 Subject: Remove the somewhat misleading logging of the string length of some unknown requests, as this appeared to be some kind of numbered error code. This brings these messages into line with similar messages that did not do this. --- OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | 4 ++-- OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 2 +- OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index 59420f5..ef9b96f 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -95,7 +95,8 @@ namespace OpenSim.Server.Handlers.Friends return DeleteFriendString(request); } - m_log.DebugFormat("[FRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); + + m_log.DebugFormat("[FRIENDS HANDLER]: unknown method request {0}", method); } catch (Exception e) { @@ -103,7 +104,6 @@ namespace OpenSim.Server.Handlers.Friends } return FailureResult(); - } #region Method-specific handlers diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index bebf482..91d14cb 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -116,7 +116,7 @@ namespace OpenSim.Server.Handlers.Grid return GetRegionFlags(request); } - m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); + m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); } catch (Exception e) { diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index 8ef03e7..c2f127c 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -122,7 +122,8 @@ namespace OpenSim.Server.Handlers.Hypergrid return GrantRights(request); */ } - m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0} request {1}", method.Length, method); + + m_log.DebugFormat("[HGFRIENDS HANDLER]: unknown method {0}", method); } catch (Exception e) { -- cgit v1.1 From 100e4ca67ea5f9eacc575ac65ce3ac7cd81eeb3d Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Thu, 3 May 2012 19:00:09 +0200 Subject: Fixes Mantis #5999. llSetLinkPrimitiveParams with PRIM_BUMP_SHINY did cause a runtime error. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 62b5c0f..704dfc3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7336,7 +7336,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; face = (int)rules.GetLSLIntegerItem(idx++); int shiny = (int)rules.GetLSLIntegerItem(idx++); - Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); + Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); SetShiny(part, face, shiny, bump); -- cgit v1.1 From fcd5b0817be93ccbb9897b424f70c5081a445e9f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 May 2012 22:30:36 +0100 Subject: Reinsert a 2000ms delay before closing a no longer required agent on the source region after teleport to resolve Imprudence teleport problems. Viewers 1 and 3 are fine with doing this immediately. However, Imprudence has a small delay (<200ms, >500ms) after receiving the AgentCompleteMovement reply packet on the destination region before regarding that region as the currnet region. If Imprudence receives a DisableSimulator in this period, it quits. We are not restoring the full 5000ms delay since this brings back a bug where teleports permanently fail if an avatar tries to teleport back too quickly. This commit also sends the AgentCompleteMovement packet to the client before telling the source region to release its old agent, in order to further cut down any possibility of the DisableSimulator being recieved before the AgentMovementComplete. --- .../Framework/EntityTransfer/EntityTransferModule.cs | 9 +++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 ++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index e47c339..cd588e5 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Net; using System.Reflection; using System.Threading; - using OpenSim.Framework; using OpenSim.Framework.Capabilities; using OpenSim.Framework.Client; @@ -595,7 +594,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) { -// Thread.Sleep(5000); + // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before + // they regard the new region as the current region after receiving the AgentMovementComplete + // response. If close is sent before then, it will cause the viewer to quit instead. + // However, if this delay is longer, then a viewer can teleport back to this region and experience + // a failure because the old ScenePresence has not yet been cleaned up. + Thread.Sleep(2000); + sp.Close(); sp.Scene.IncomingCloseAgent(sp.UUID); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e5a9a99..91e6e5a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1140,9 +1140,19 @@ namespace OpenSim.Region.Framework.Scenes bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); MakeRootAgent(AbsolutePosition, flying); + ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); + +// m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); if ((m_callbackURI != null) && !m_callbackURI.Equals("")) { + // We cannot sleep here since this would hold up the inbound packet processing thread, as + // CompleteMovement() is executed synchronously. However, it might be better to delay the release + // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete + // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this + // region as the current region, meaning that a close sent before then will fail the teleport. +// System.Threading.Thread.Sleep(2000); + m_log.DebugFormat( "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", client.Name, client.AgentId, m_callbackURI); @@ -1151,9 +1161,6 @@ namespace OpenSim.Region.Framework.Scenes m_callbackURI = null; } -// m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); - - ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); ValidateAndSendAppearanceAndAgentData(); // Create child agents in neighbouring regions @@ -1168,7 +1175,6 @@ namespace OpenSim.Region.Framework.Scenes friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); } - // m_log.DebugFormat( // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); -- cgit v1.1 From c9faf0df741c89ec92b09d54ab471b070e5a1dff Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 01:12:56 +0100 Subject: Extend 'slow' request logging to other server outbound requests (forms, rest, async rest) as well as the existing logging on outbound OSD requests. Also prints out the first 100 chars of any slow request data since this can contain useful info (such as agent ID). --- OpenSim/Framework/WebUtil.cs | 273 ++++++++++++++++++++++++++++++------------- 1 file changed, 194 insertions(+), 79 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index d2aa538..478d2a7 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -53,19 +53,36 @@ namespace OpenSim.Framework LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private static int m_requestNumber = 0; + /// + /// Request number for diagnostic purposes. + /// + public static int RequestNumber = 0; - // this is the header field used to communicate the local request id - // used for performance and debugging + /// + /// this is the header field used to communicate the local request id + /// used for performance and debugging + /// public const string OSHeaderRequestID = "opensim-request-id"; - // number of milliseconds a call can take before it is considered - // a "long" call for warning & debugging purposes + /// + /// Number of milliseconds a call can take before it is considered + /// a "long" call for warning & debugging purposes + /// public const int LongCallTime = 500; - // dictionary of end points + /// + /// The maximum length of any data logged because of a long request time. + /// + /// + /// This is to truncate any really large post data, such as an asset. In theory, the first section should + /// give us useful information about the call (which agent it relates to if applicable, etc.). + /// + public const int MaxRequestDiagLength = 100; + + /// + /// Dictionary of end points + /// private static Dictionary m_endpointSerializer = new Dictionary(); - private static object EndPointLock(string url) { @@ -128,12 +145,13 @@ namespace OpenSim.Framework private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) { - int reqnum = m_requestNumber++; + int reqnum = RequestNumber++; // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; + string strBuffer = null; try { @@ -148,7 +166,7 @@ namespace OpenSim.Framework // If there is some input, write it into the request if (data != null) { - string strBuffer = OSDParser.SerializeJsonString(data); + strBuffer = OSDParser.SerializeJsonString(data); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); if (compressed) @@ -208,11 +226,18 @@ namespace OpenSim.Framework } finally { - // This just dumps a warning for any operation that takes more than 100 ms int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) - m_log.DebugFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", - reqnum,url,method,tickdiff,tickdata); + m_log.InfoFormat( + "[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + reqnum, + method, + url, + tickdiff, + tickdata, + strBuffer != null + ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) + : ""); } m_log.DebugFormat( @@ -290,17 +315,17 @@ namespace OpenSim.Framework private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout) { - int reqnum = m_requestNumber++; + int reqnum = RequestNumber++; string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; + string queryString = null; try { - HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = "POST"; request.Timeout = timeout; @@ -311,7 +336,7 @@ namespace OpenSim.Framework if (data != null) { - string queryString = BuildQueryString(data); + queryString = BuildQueryString(data); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); request.ContentLength = buffer.Length; @@ -354,11 +379,19 @@ namespace OpenSim.Framework { int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) - m_log.InfoFormat("[WEB UTIL]: form request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing", - reqnum,url,method,tickdiff,tickdata); + m_log.InfoFormat( + "[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + reqnum, + method, + url, + tickdiff, + tickdata, + queryString != null + ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString + : ""); } - m_log.WarnFormat("[WEB UTIL]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage); + m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage); return ErrorResponseMap(errorMessage); } @@ -639,8 +672,6 @@ namespace OpenSim.Framework return new string[0]; } - - } public static class AsynchronousRestObjectRequester @@ -663,6 +694,12 @@ namespace OpenSim.Framework public static void MakeRequest(string verb, string requestUrl, TRequest obj, Action action) { + int reqnum = WebUtil.RequestNumber++; + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); + + int tickstart = Util.EnvironmentTickCount(); + int tickdata = 0; + // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); Type type = typeof(TRequest); @@ -673,12 +710,13 @@ namespace OpenSim.Framework XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); request.Method = verb; + MemoryStream buffer = null; if (verb == "POST") { request.ContentType = "text/xml"; - MemoryStream buffer = new MemoryStream(); + buffer = new MemoryStream(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; @@ -700,6 +738,9 @@ namespace OpenSim.Framework requestStream.Write(buffer.ToArray(), 0, length); requestStream.Close(); + // capture how much time was spent writing + tickdata = Util.EnvironmentTickCountSubtract(tickstart); + request.BeginGetResponse(delegate(IAsyncResult ar) { response = request.EndGetResponse(ar); @@ -725,88 +766,108 @@ namespace OpenSim.Framework }, null); }, null); - - - return; } - - request.BeginGetResponse(delegate(IAsyncResult res2) + else { - try + request.BeginGetResponse(delegate(IAsyncResult res2) { - // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't - // documented in MSDN - response = request.EndGetResponse(res2); - - Stream respStream = null; try { - respStream = response.GetResponseStream(); - deserial = (TResponse)deserializer.Deserialize(respStream); - } - catch (System.InvalidOperationException) - { - } - finally - { - respStream.Close(); - response.Close(); + // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't + // documented in MSDN + response = request.EndGetResponse(res2); + + Stream respStream = null; + try + { + respStream = response.GetResponseStream(); + deserial = (TResponse)deserializer.Deserialize(respStream); + } + catch (System.InvalidOperationException) + { + } + finally + { + respStream.Close(); + response.Close(); + } } - } - catch (WebException e) - { - if (e.Status == WebExceptionStatus.ProtocolError) + catch (WebException e) { - if (e.Response is HttpWebResponse) + if (e.Status == WebExceptionStatus.ProtocolError) { - HttpWebResponse httpResponse = (HttpWebResponse)e.Response; - - if (httpResponse.StatusCode != HttpStatusCode.NotFound) + if (e.Response is HttpWebResponse) { - // We don't appear to be handling any other status codes, so log these feailures to that - // people don't spend unnecessary hours hunting phantom bugs. - m_log.DebugFormat( - "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", - verb, requestUrl, httpResponse.StatusCode); + HttpWebResponse httpResponse = (HttpWebResponse)e.Response; + + if (httpResponse.StatusCode != HttpStatusCode.NotFound) + { + // We don't appear to be handling any other status codes, so log these feailures to that + // people don't spend unnecessary hours hunting phantom bugs. + m_log.DebugFormat( + "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", + verb, requestUrl, httpResponse.StatusCode); + } } } + else + { + m_log.ErrorFormat( + "[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", + verb, requestUrl, e.Status, e.Message); + } } - else + catch (Exception e) { m_log.ErrorFormat( - "[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", - verb, requestUrl, e.Status, e.Message); + "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}", + verb, requestUrl, e.Message, e.StackTrace); } - } - catch (Exception e) - { - m_log.ErrorFormat( - "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}", - verb, requestUrl, e.Message, e.StackTrace); - } + + // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); + + try + { + action(deserial); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}{3}", + verb, requestUrl, e.Message, e.StackTrace); + } + + }, null); + } - // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); + int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); + if (tickdiff > WebUtil.LongCallTime) + { + string originalRequest = null; - try - { - action(deserial); - } - catch (Exception e) + if (buffer != null) { - m_log.ErrorFormat( - "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}{3}", - verb, requestUrl, e.Message, e.StackTrace); + originalRequest = Encoding.UTF8.GetString(buffer.ToArray()); + + if (originalRequest.Length > WebUtil.MaxRequestDiagLength) + originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength); } - }, null); + m_log.InfoFormat( + "[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + reqnum, + verb, + requestUrl, + tickdiff, + tickdata, + originalRequest); + } } } public static class SynchronousRestFormsRequester { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// /// Perform a synchronous REST request. @@ -820,6 +881,12 @@ namespace OpenSim.Framework /// the request. You'll want to make sure you deal with this as they're not uncommon public static string MakeRequest(string verb, string requestUrl, string obj) { + int reqnum = WebUtil.RequestNumber++; + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); + + int tickstart = Util.EnvironmentTickCount(); + int tickdata = 0; + WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; string respstring = String.Empty; @@ -855,6 +922,9 @@ namespace OpenSim.Framework { if (requestStream != null) requestStream.Close(); + + // capture how much time was spent writing + tickdata = Util.EnvironmentTickCountSubtract(tickstart); } } @@ -893,6 +963,18 @@ namespace OpenSim.Framework m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving {0} {1}", verb, requestUrl); } } + + int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); + if (tickdiff > WebUtil.LongCallTime) + m_log.InfoFormat( + "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + reqnum, + verb, + requestUrl, + tickdiff, + tickdata, + obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); + return respstring; } } @@ -915,17 +997,24 @@ namespace OpenSim.Framework /// the request. You'll want to make sure you deal with this as they're not uncommon public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj) { + int reqnum = WebUtil.RequestNumber++; + // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); + + int tickstart = Util.EnvironmentTickCount(); + int tickdata = 0; + Type type = typeof(TRequest); TResponse deserial = default(TResponse); WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + MemoryStream buffer = null; if ((verb == "POST") || (verb == "PUT")) { request.ContentType = "text/xml"; - MemoryStream buffer = new MemoryStream(); + buffer = new MemoryStream(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; @@ -958,6 +1047,9 @@ namespace OpenSim.Framework { if (requestStream != null) requestStream.Close(); + + // capture how much time was spent writing + tickdata = Util.EnvironmentTickCountSubtract(tickstart); } } @@ -1005,6 +1097,29 @@ namespace OpenSim.Framework verb, requestUrl, e.Message, e.StackTrace); } + int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); + if (tickdiff > WebUtil.LongCallTime) + { + string originalRequest = null; + + if (buffer != null) + { + originalRequest = Encoding.UTF8.GetString(buffer.ToArray()); + + if (originalRequest.Length > WebUtil.MaxRequestDiagLength) + originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength); + } + + m_log.InfoFormat( + "[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", + reqnum, + verb, + requestUrl, + tickdiff, + tickdata, + originalRequest); + } + return deserial; } } -- cgit v1.1 From fb99ee67743dddd75c2b65039f227188f46cc389 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 01:16:56 +0100 Subject: minor: Tweak BaseHttpServer message to make it clear that this relates to slow handling of inbound requests. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 4ea4a1a..6fa36b5 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -677,7 +677,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (tickdiff > 3000) { m_log.InfoFormat( - "[BASE HTTP SERVER]: slow {0} for {1} {2} {3} from {4} took {5} ms", + "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", requestMethod, uriString, requestHandler != null ? requestHandler.Name : "", -- cgit v1.1 From cccef2e56dc8b02ccd83fb1c832e4ce026cdcaf9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 19:21:43 +0100 Subject: Calculate the Daylight Savings Time information sent to the viewer based on US Pacific Standard Time rather than whatever timezone the login server is set to. This is because the viewer doesn't receive a timezone from the server but bases its displays on Pacific Standard Time. However, it still expects to receive notification from the server as to whether or not Daylight Savings Time for PST is in operation. This commit introduces a new DSTZone setting in the [LoginService] config setting that accepts a list of timezone names valid across different platforms to calculate Pacific DST. If you need the old behaviour of calculating DST based on the local timezone of the server running the login service, then please override DSTZone with "local". A mailing list announcement will be made later. Thanks to Olivier Van Helden and Gudule Lapointe for determining this behaviour and providing this patch. From http://opensimulator.org/mantis/view.php?id=5972 --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 43 +++++++++++++++++++++- OpenSim/Services/LLLoginService/LLLoginService.cs | 17 +++++++-- 2 files changed, 55 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 01de159..6b3bc84 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -226,7 +226,8 @@ namespace OpenSim.Services.LLLoginService public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, GridRegion destination, List invSkel, FriendInfo[] friendsList, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, List gestures, string message, - GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency) + GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, + string DSTZone) : this() { FillOutInventoryData(invSkel, libService); @@ -255,7 +256,45 @@ namespace OpenSim.Services.LLLoginService FillOutRegionData(destination); FillOutSeedCap(aCircuit, destination, clientIP); - + + switch (DSTZone) + { + case "none": + DST = "N"; + break; + case "local": + DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; + break; + default: + TimeZoneInfo dstTimeZone = null; + string[] tzList = DSTZone.Split(';'); + + foreach (string tzName in tzList) + { + try + { + dstTimeZone = TimeZoneInfo.FindSystemTimeZoneById(tzName); + } + catch (Exception e) + { + continue; + } + break; + } + + if (dstTimeZone == null) + { + m_log.WarnFormat( + "[LLOGIN RESPONSE]: No valid timezone found for DST in {0}, falling back to system time.", tzList); + DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; + } + else + { + DST = dstTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; + } + + break; + } } private void FillOutInventoryData(List invSkel, ILibraryService libService) diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index db8a9cb..9acba11 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -82,6 +82,8 @@ namespace OpenSim.Services.LLLoginService protected string m_AllowedClients; protected string m_DeniedClients; + protected string m_DSTZone; + IConfig m_LoginServerConfig; // IConfig m_ClientsConfig; @@ -118,6 +120,8 @@ namespace OpenSim.Services.LLLoginService m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); + m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); + // Clean up some of these vars if (m_MapTileURL != String.Empty) { @@ -240,6 +244,7 @@ namespace OpenSim.Services.LLLoginService m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}", firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0); + try { // @@ -416,8 +421,11 @@ namespace OpenSim.Services.LLLoginService // // Finally, fill out the response and return it // - LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, - where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency); + LLLoginResponse response + = new LLLoginResponse( + account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, + where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, + m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone); m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); return response; @@ -431,7 +439,10 @@ namespace OpenSim.Services.LLLoginService } } - protected GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags) + protected GridRegion FindDestination( + UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, + GridRegion home, out GridRegion gatekeeper, + out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags) { flags = TeleportFlags.ViaLogin; -- cgit v1.1 From ad23774433b55e0cfbfc50208b247f0c3f41e8ea Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 23 Apr 2012 18:36:36 +0300 Subject: Allow deleting folders even if they're not in the Trash The functions DeleteFolders() and PurgeFolder() still work as before, i.e. they only allow deleting folders that are in the Trash. However, the functions DeleteFoldersEx() and PurgeFolderEx() can now be used to delete any folder. --- .../Services/InventoryService/XInventoryService.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 0e7a358..37a6a42 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -364,6 +364,11 @@ namespace OpenSim.Services.InventoryService // public virtual bool DeleteFolders(UUID principalID, List folderIDs) { + return DeleteFoldersEx(principalID, folderIDs, true); + } + + public bool DeleteFoldersEx(UUID principalID, List folderIDs, bool onlyIfTrash) + { if (!m_AllowDelete) return false; @@ -371,11 +376,12 @@ namespace OpenSim.Services.InventoryService // foreach (UUID id in folderIDs) { - if (!ParentIsTrash(id)) + if (onlyIfTrash && !ParentIsTrash(id)) continue; + //m_log.InfoFormat("[XINVENTORY SERVICE]: Delete folder {0}", id); InventoryFolderBase f = new InventoryFolderBase(); f.ID = id; - PurgeFolder(f); + PurgeFolderEx(f, onlyIfTrash); m_Database.DeleteFolders("folderID", id.ToString()); } @@ -384,10 +390,15 @@ namespace OpenSim.Services.InventoryService public virtual bool PurgeFolder(InventoryFolderBase folder) { + return PurgeFolderEx(folder, true); + } + + private bool PurgeFolderEx(InventoryFolderBase folder, bool onlyIfTrash) + { if (!m_AllowDelete) return false; - if (!ParentIsTrash(folder.ID)) + if (onlyIfTrash && !ParentIsTrash(folder.ID)) return false; XInventoryFolder[] subFolders = m_Database.GetFolders( @@ -396,7 +407,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryFolder x in subFolders) { - PurgeFolder(ConvertToOpenSim(x)); + PurgeFolderEx(ConvertToOpenSim(x), onlyIfTrash); m_Database.DeleteFolders("folderID", x.folderID.ToString()); } -- cgit v1.1 From e83bc049dffba51a4d739d150cbd82a68453a0c6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 20:37:21 +0100 Subject: refactor: Rename new DeleteFoldersEx/PurgeFoldersEx methods to DeleteFolders/PurgeFolders overloads as previously discussed with Oren - I think this makes more sense on balance These overloads are not publicly available on core connectors or IInventoryService. --- OpenSim/Services/InventoryService/XInventoryService.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 37a6a42..15156d0 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -52,6 +52,7 @@ namespace OpenSim.Services.InventoryService : this(config, "InventoryService") { } + public XInventoryService(IConfigSource config, string configName) : base(config) { if (configName != string.Empty) @@ -364,10 +365,10 @@ namespace OpenSim.Services.InventoryService // public virtual bool DeleteFolders(UUID principalID, List folderIDs) { - return DeleteFoldersEx(principalID, folderIDs, true); + return DeleteFolders(principalID, folderIDs, true); } - public bool DeleteFoldersEx(UUID principalID, List folderIDs, bool onlyIfTrash) + public virtual bool DeleteFolders(UUID principalID, List folderIDs, bool onlyIfTrash) { if (!m_AllowDelete) return false; @@ -381,7 +382,7 @@ namespace OpenSim.Services.InventoryService //m_log.InfoFormat("[XINVENTORY SERVICE]: Delete folder {0}", id); InventoryFolderBase f = new InventoryFolderBase(); f.ID = id; - PurgeFolderEx(f, onlyIfTrash); + PurgeFolder(f, onlyIfTrash); m_Database.DeleteFolders("folderID", id.ToString()); } @@ -390,10 +391,10 @@ namespace OpenSim.Services.InventoryService public virtual bool PurgeFolder(InventoryFolderBase folder) { - return PurgeFolderEx(folder, true); + return PurgeFolder(folder, true); } - private bool PurgeFolderEx(InventoryFolderBase folder, bool onlyIfTrash) + public virtual bool PurgeFolder(InventoryFolderBase folder, bool onlyIfTrash) { if (!m_AllowDelete) return false; @@ -407,7 +408,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryFolder x in subFolders) { - PurgeFolderEx(ConvertToOpenSim(x), onlyIfTrash); + PurgeFolder(ConvertToOpenSim(x), onlyIfTrash); m_Database.DeleteFolders("folderID", x.folderID.ToString()); } -- cgit v1.1 From 6096a1f30ed7857b1dbacf152dba4f0aa7e6e1e9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 20:53:30 +0100 Subject: Change LongCallTime on WebUtil to 3000, to match the time where request handling is considered "slow". This may be the wrong thing to do but stops lots of log spam in HG setups now that the monitoring is extended to other outgoing calls. LongCallTime may need to be made configurable. --- OpenSim/Framework/WebUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 478d2a7..2aa4af5 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -68,7 +68,7 @@ namespace OpenSim.Framework /// Number of milliseconds a call can take before it is considered /// a "long" call for warning & debugging purposes /// - public const int LongCallTime = 500; + public const int LongCallTime = 3000; /// /// The maximum length of any data logged because of a long request time. -- cgit v1.1 From 92fde6ed268f4c7357ca5ad96b967db0f0658446 Mon Sep 17 00:00:00 2001 From: Talun Date: Fri, 4 May 2012 19:37:13 +0100 Subject: Mantis 60004 problems with damage and llSetDamage. In damage enabled areas this patch - Deletes any objects that have damage set > 0 that deliver that damage to an avatar Stops Gods receiving damage, Stops volume detect objects causing damage Deletes NPCS when their helth reduces to zero Gradually "heals" damage to an avatar Resets health on going to a non damage area --- .../CoreModules/Avatar/Combat/CombatModule.cs | 17 +++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 53 +++++++++++++++++++--- 2 files changed, 60 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 0babeb5..3a91465 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -96,6 +96,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule ScenePresence killingAvatar = null; // string killingAvatarMessage; + // check to see if it is an NPC and just remove it + INPCModule NPCmodule = deadAvatar.Scene.RequestModuleInterface(); + if (NPCmodule != null && NPCmodule.DeleteNPC(deadAvatar.UUID, deadAvatar.Scene)) + { + return; + } + if (killerObjectLocalID == 0) deadAvatarMessage = "You committed suicide!"; else @@ -145,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule catch (InvalidOperationException) { } - deadAvatar.Health = 100; + deadAvatar.setHealthWithUpdate(100.0f); deadAvatar.Scene.TeleportClientHome(deadAvatar.UUID, deadAvatar.ControllingClient); } @@ -154,14 +161,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule try { ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); - - if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) + if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 + || avatar.Scene.RegionInfo.RegionSettings.AllowDamage) { avatar.Invulnerable = false; } else { avatar.Invulnerable = true; + if (avatar.Health < 100.0f) + { + avatar.setHealthWithUpdate(100.0f); + } } } catch (Exception) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 91e6e5a..7e49a5e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3312,23 +3312,53 @@ namespace OpenSim.Region.Framework.Scenes } } - if (Invulnerable) + // Gods do not take damage and Invulnerable is set depending on parcel/region flags + if (Invulnerable || GodLevel > 0) return; - + + // The following may be better in the ICombatModule + // probably tweaking of the values for ground and normal prim collisions will be needed float starthealth = Health; uint killerObj = 0; + SceneObjectPart part = null; foreach (uint localid in coldata.Keys) { - SceneObjectPart part = Scene.GetSceneObjectPart(localid); - - if (part != null && part.ParentGroup.Damage != -1.0f) - Health -= part.ParentGroup.Damage; + if (localid == 0) + { + part = null; + } + else + { + part = Scene.GetSceneObjectPart(localid); + } + if (part != null) + { + // Ignore if it has been deleted or volume detect + if (!part.ParentGroup.IsDeleted && !part.ParentGroup.IsVolumeDetect) + { + if (part.ParentGroup.Damage > 0.0f) + { + // Something with damage... + Health -= part.ParentGroup.Damage; + part.ParentGroup.Scene.DeleteSceneObject(part.ParentGroup, false); + } + else + { + // An ordinary prim + if (coldata[localid].PenetrationDepth >= 0.10f) + Health -= coldata[localid].PenetrationDepth * 5.0f; + } + } + } else { - if (coldata[localid].PenetrationDepth >= 0.10f) + // 0 is the ground + // what about collisions with other avatars? + if (localid == 0 && coldata[localid].PenetrationDepth >= 0.10f) Health -= coldata[localid].PenetrationDepth * 5.0f; } + if (Health <= 0.0f) { if (localid != 0) @@ -3344,7 +3374,16 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendHealth(Health); } if (Health <= 0) + { m_scene.EventManager.TriggerAvatarKill(killerObj, this); + } + if (starthealth == Health && Health < 100.0f) + { + Health += 0.03f; + if (Health > 100.0f) + Health = 100.0f; + ControllingClient.SendHealth(Health); + } } } -- cgit v1.1 From c84ef57e5273ac2c8703c75406138c58f9c19d0f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 21:04:42 +0100 Subject: minor: remove mono compiler warning --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 6b3bc84..9ec744f 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -275,7 +275,7 @@ namespace OpenSim.Services.LLLoginService { dstTimeZone = TimeZoneInfo.FindSystemTimeZoneById(tzName); } - catch (Exception e) + catch { continue; } -- cgit v1.1 From da4819a170071d2acae309606c4ac2cf9f772a39 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 22:11:25 +0100 Subject: Temporarily add debug log lines to lsl url request and release To help with http://opensimulator.org/mantis/view.php?id=5993 --- OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 93e75b3..d58fc0f 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -146,6 +146,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp public void Close() { } + public UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID) { UUID urlcode = UUID.Random(); @@ -175,6 +176,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp uri, new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode)); + m_log.DebugFormat( + "[URL MODULE]: Set up incoming request url {0} for {1} in {2} {3}", + uri, itemID, host.Name, host.LocalId); + engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); } @@ -217,6 +222,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp uri, new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, urlcode)); + m_log.DebugFormat( + "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}", + uri, itemID, host.Name, host.LocalId); + engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); } @@ -237,6 +246,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp foreach (UUID req in data.requests.Keys) m_RequestMap.Remove(req); + m_log.DebugFormat( + "[URL MODULE]: Releasing url {0} for {1} in {2}", + url, data.itemID, data.hostID); + RemoveUrl(data); m_UrlMap.Remove(url); } -- cgit v1.1 From dec6ad2933f75d4ac475a5e1c4302fe758c60d6d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 22:57:33 +0100 Subject: Don't try and update the access time of a file that is actively being cached. This may cause IOErrors on Windows. Aims to help with http://opensimulator.org/mantis/view.php?id=6003 --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 389fb7b..a25976d 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -261,10 +261,14 @@ namespace Flotsam.RegionModules.AssetCache try { - // If the file is already cached, don't cache it, just touch it so access time is updated + // If the file is already cached just update access time. if (File.Exists(filename)) { - File.SetLastAccessTime(filename, DateTime.Now); + lock (m_CurrentlyWriting) + { + if (!m_CurrentlyWriting.Contains(filename)) + File.SetLastAccessTime(filename, DateTime.Now); + } } else { -- cgit v1.1 From e18686528ea09d72dd75da341da7bbb6f1fad5aa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 23:03:33 +0100 Subject: Use the more efficient HashSet instead of List for FlotasmAssetCache.m_CurrentlyWriting --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index a25976d..dd6026b 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -83,7 +83,7 @@ namespace Flotsam.RegionModules.AssetCache private Dictionary m_CurrentlyWriting = new Dictionary(); private int m_WaitOnInprogressTimeout = 3000; #else - private List m_CurrentlyWriting = new List(); + private HashSet m_CurrentlyWriting = new HashSet(); #endif private bool m_FileCacheEnabled = true; -- cgit v1.1 From 01b00ad0d57d828028379875a382965b44073497 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 5 May 2012 00:29:14 +0100 Subject: Fire the scripting changed event with CHANGED_OWNER when an object that has changed owners is rezzed. This needs to occur after the script is resumed rather than before, when the event is just dropped. Addresses http://opensimulator.org/mantis/view.php?id=5890 and http://opensimulator.org/mantis/view.php?id=5952 --- OpenSim/Framework/TaskInventoryItem.cs | 16 +++++++++++++--- .../Avatar/Attachments/AttachmentsModule.cs | 18 +++++++++--------- .../Region/CoreModules/World/Land/PrimCountModule.cs | 1 - .../Framework/Scenes/SceneObjectPartInventory.cs | 10 ++++++++-- 4 files changed, 30 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index d4bbbfb..362d365 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -26,6 +26,8 @@ */ using System; +using System.Reflection; +using log4net; using OpenMetaverse; namespace OpenSim.Framework @@ -35,6 +37,8 @@ namespace OpenSim.Framework /// public class TaskInventoryItem : ICloneable { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// XXX This should really be factored out into some constants class. /// @@ -331,12 +335,18 @@ namespace OpenSim.Framework } } - public bool OwnerChanged { - get { + public bool OwnerChanged + { + get + { return _ownerChanged; } - set { + set + { _ownerChanged = value; +// m_log.DebugFormat( +// "[TASK INVENTORY ITEM]: Owner changed set {0} for {1} {2} owned by {3}", +// _ownerChanged, Name, ItemID, OwnerID); } } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 7200c4b..2e1948d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -527,9 +527,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments private void AttachToAgent( IScenePresence sp, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) { - // m_log.DebugFormat( - // "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", - // so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); +// m_log.DebugFormat( +// "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", +// so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); so.DetachFromBackup(); @@ -788,9 +788,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// private void ShowAttachInUserInventory(IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att) { - // m_log.DebugFormat( - // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", - // att.Name, sp.Name, AttachmentPt, itemID); +// m_log.DebugFormat( +// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", +// att.Name, sp.Name, AttachmentPt, itemID); if (UUID.Zero == itemID) { @@ -853,9 +853,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments private void Client_OnObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) { - // m_log.DebugFormat( - // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", - // objectLocalID, remoteClient.Name, AttachmentPt, silent); +// m_log.DebugFormat( +// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", +// objectLocalID, remoteClient.Name, AttachmentPt, silent); if (!Enabled) return; diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index efede5c..b2f71d1 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -126,7 +126,6 @@ namespace OpenSim.Region.CoreModules.World.Land // m_log.DebugFormat( // "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", // obj.Name, m_Scene.RegionInfo.RegionName); - } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index aacad98..3734e03 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -1219,13 +1219,19 @@ namespace OpenSim.Region.Framework.Scenes { if (engine != null) { +// m_log.DebugFormat( +// "[PRIM INVENTORY]: Resuming script {0} {1} for {2}, OwnerChanged {3}", +// item.Name, item.ItemID, item.OwnerID, item.OwnerChanged); + + engine.ResumeScript(item.ItemID); + if (item.OwnerChanged) engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); + item.OwnerChanged = false; - engine.ResumeScript(item.ItemID); } } } } } -} +} \ No newline at end of file -- cgit v1.1