diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules')
4 files changed, 117 insertions, 16 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 992f38e..79509ab 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Text; | 32 | using System.Text; |
32 | using log4net; | 33 | using log4net; |
@@ -51,7 +52,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] | 52 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] |
52 | public class LindenUDPInfoModule : ISharedRegionModule | 53 | public class LindenUDPInfoModule : ISharedRegionModule |
53 | { | 54 | { |
54 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 56 | ||
56 | protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 57 | protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
57 | 58 | ||
@@ -130,6 +131,15 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
130 | "Go on/off emergency monitoring mode", | 131 | "Go on/off emergency monitoring mode", |
131 | "Go on/off emergency monitoring mode", | 132 | "Go on/off emergency monitoring mode", |
132 | HandleEmergencyMonitoring); | 133 | HandleEmergencyMonitoring); |
134 | |||
135 | scene.AddCommand( | ||
136 | "Comms", this, "show client stats", | ||
137 | "show client stats [first_name last_name]", | ||
138 | "Show client request stats", | ||
139 | "Without the 'first_name last_name' option, all clients are shown." | ||
140 | + " With the 'first_name last_name' option only a specific client is shown.", | ||
141 | (mod, cmd) => MainConsole.Instance.Output(HandleClientStatsReport(cmd))); | ||
142 | |||
133 | } | 143 | } |
134 | 144 | ||
135 | public void RemoveRegion(Scene scene) | 145 | public void RemoveRegion(Scene scene) |
@@ -587,6 +597,102 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
587 | (throttleRates.Asset * 8) / 1000); | 597 | (throttleRates.Asset * 8) / 1000); |
588 | 598 | ||
589 | return report.ToString(); | 599 | return report.ToString(); |
590 | } | 600 | } |
601 | |||
602 | /// <summary> | ||
603 | /// Show client stats data | ||
604 | /// </summary> | ||
605 | /// <param name="showParams"></param> | ||
606 | /// <returns></returns> | ||
607 | protected string HandleClientStatsReport(string[] showParams) | ||
608 | { | ||
609 | // NOTE: This writes to m_log on purpose. We want to store this information | ||
610 | // in case we need to analyze it later. | ||
611 | // | ||
612 | if (showParams.Length <= 4) | ||
613 | { | ||
614 | m_log.InfoFormat("[INFO]: {0,-12} {1,20} {2,6} {3,11} {4, 10}", "Region", "Name", "Root", "Time", "Reqs/min"); | ||
615 | foreach (Scene scene in m_scenes.Values) | ||
616 | { | ||
617 | scene.ForEachClient( | ||
618 | delegate(IClientAPI client) | ||
619 | { | ||
620 | if (client is LLClientView) | ||
621 | { | ||
622 | LLClientView llClient = client as LLClientView; | ||
623 | ClientInfo cinfo = llClient.UDPClient.GetClientInfo(); | ||
624 | int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); | ||
625 | avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); | ||
626 | |||
627 | m_log.InfoFormat("[INFO]: {0,-12} {1,20} {2,4} {3,9}min {4,10}", | ||
628 | scene.RegionInfo.RegionName, llClient.Name, | ||
629 | (llClient.SceneAgent.IsChildAgent ? "N" : "Y"), (DateTime.Now - cinfo.StartedTime).Minutes, avg_reqs); | ||
630 | } | ||
631 | }); | ||
632 | } | ||
633 | return string.Empty; | ||
634 | } | ||
635 | |||
636 | string fname = "", lname = ""; | ||
637 | |||
638 | if (showParams.Length > 3) | ||
639 | fname = showParams[3]; | ||
640 | if (showParams.Length > 4) | ||
641 | lname = showParams[4]; | ||
642 | |||
643 | foreach (Scene scene in m_scenes.Values) | ||
644 | { | ||
645 | scene.ForEachClient( | ||
646 | delegate(IClientAPI client) | ||
647 | { | ||
648 | if (client is LLClientView) | ||
649 | { | ||
650 | LLClientView llClient = client as LLClientView; | ||
651 | |||
652 | if (llClient.Name == fname + " " + lname) | ||
653 | { | ||
654 | |||
655 | ClientInfo cinfo = llClient.GetClientInfo(); | ||
656 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(llClient.CircuitCode); | ||
657 | if (aCircuit == null) // create a dummy one | ||
658 | aCircuit = new AgentCircuitData(); | ||
659 | |||
660 | if (!llClient.SceneAgent.IsChildAgent) | ||
661 | m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, aCircuit.Viewer, aCircuit.Id0); | ||
662 | |||
663 | int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); | ||
664 | avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); | ||
665 | |||
666 | m_log.InfoFormat("[INFO]:"); | ||
667 | m_log.InfoFormat("[INFO]: {0} # {1} # Time: {2}min # Avg Reqs/min: {3}", scene.RegionInfo.RegionName, | ||
668 | (llClient.SceneAgent.IsChildAgent ? "Child" : "Root"), (DateTime.Now - cinfo.StartedTime).Minutes, avg_reqs); | ||
669 | |||
670 | Dictionary<string, int> sortedDict = (from entry in cinfo.AsyncRequests orderby entry.Value descending select entry) | ||
671 | .ToDictionary(pair => pair.Key, pair => pair.Value); | ||
672 | PrintRequests("TOP ASYNC", sortedDict, cinfo.AsyncRequests.Values.Sum()); | ||
673 | |||
674 | sortedDict = (from entry in cinfo.SyncRequests orderby entry.Value descending select entry) | ||
675 | .ToDictionary(pair => pair.Key, pair => pair.Value); | ||
676 | PrintRequests("TOP SYNC", sortedDict, cinfo.SyncRequests.Values.Sum()); | ||
677 | |||
678 | sortedDict = (from entry in cinfo.GenericRequests orderby entry.Value descending select entry) | ||
679 | .ToDictionary(pair => pair.Key, pair => pair.Value); | ||
680 | PrintRequests("TOP GENERIC", sortedDict, cinfo.GenericRequests.Values.Sum()); | ||
681 | } | ||
682 | } | ||
683 | }); | ||
684 | } | ||
685 | return string.Empty; | ||
686 | } | ||
687 | |||
688 | private void PrintRequests(string type, Dictionary<string, int> sortedDict, int sum) | ||
689 | { | ||
690 | m_log.InfoFormat("[INFO]:"); | ||
691 | m_log.InfoFormat("[INFO]: {0,25}", type); | ||
692 | foreach (KeyValuePair<string, int> kvp in sortedDict.Take(12)) | ||
693 | m_log.InfoFormat("[INFO]: {0,25} {1,-6}", kvp.Key, kvp.Value); | ||
694 | m_log.InfoFormat("[INFO]: {0,25}", "..."); | ||
695 | m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum); | ||
696 | } | ||
591 | } | 697 | } |
592 | } \ No newline at end of file | 698 | } \ No newline at end of file |
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs index 3a39971..d8f5563 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs | |||
@@ -139,18 +139,21 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
139 | { | 139 | { |
140 | string capsBase = "/CAPS/" + caps.CapsObjectPath; | 140 | string capsBase = "/CAPS/" + caps.CapsObjectPath; |
141 | 141 | ||
142 | IRequestHandler renderMaterialsPostHandler = new RestStreamHandler("POST", capsBase + "/", RenderMaterialsPostCap); | 142 | IRequestHandler renderMaterialsPostHandler |
143 | = new RestStreamHandler("POST", capsBase + "/", RenderMaterialsPostCap, "RenderMaterials", null); | ||
143 | caps.RegisterHandler("RenderMaterials", renderMaterialsPostHandler); | 144 | caps.RegisterHandler("RenderMaterials", renderMaterialsPostHandler); |
144 | 145 | ||
145 | // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET | 146 | // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET |
146 | // and POST handlers, (at least at the time this was originally written), so we first set up a POST | 147 | // and POST handlers, (at least at the time this was originally written), so we first set up a POST |
147 | // handler normally and then add a GET handler via MainServer | 148 | // handler normally and then add a GET handler via MainServer |
148 | 149 | ||
149 | IRequestHandler renderMaterialsGetHandler = new RestStreamHandler("GET", capsBase + "/", RenderMaterialsGetCap); | 150 | IRequestHandler renderMaterialsGetHandler |
151 | = new RestStreamHandler("GET", capsBase + "/", RenderMaterialsGetCap, "RenderMaterials", null); | ||
150 | MainServer.Instance.AddStreamHandler(renderMaterialsGetHandler); | 152 | MainServer.Instance.AddStreamHandler(renderMaterialsGetHandler); |
151 | 153 | ||
152 | // materials viewer seems to use either POST or PUT, so assign POST handler for PUT as well | 154 | // materials viewer seems to use either POST or PUT, so assign POST handler for PUT as well |
153 | IRequestHandler renderMaterialsPutHandler = new RestStreamHandler("PUT", capsBase + "/", RenderMaterialsPostCap); | 155 | IRequestHandler renderMaterialsPutHandler |
156 | = new RestStreamHandler("PUT", capsBase + "/", RenderMaterialsPostCap, "RenderMaterials", null); | ||
154 | MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler); | 157 | MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler); |
155 | } | 158 | } |
156 | 159 | ||
@@ -394,7 +397,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
394 | m_log.Debug("[MaterialsDemoModule]: null SOP for localId: " + matLocalID.ToString()); | 397 | m_log.Debug("[MaterialsDemoModule]: null SOP for localId: " + matLocalID.ToString()); |
395 | else | 398 | else |
396 | { | 399 | { |
397 | //var te = sop.Shape.Textures; | ||
398 | var te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length); | 400 | var te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length); |
399 | 401 | ||
400 | if (te == null) | 402 | if (te == null) |
@@ -413,14 +415,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule | |||
413 | if (te.DefaultTexture == null) | 415 | if (te.DefaultTexture == null) |
414 | m_log.Debug("[MaterialsDemoModule]: te.DefaultTexture is null"); | 416 | m_log.Debug("[MaterialsDemoModule]: te.DefaultTexture is null"); |
415 | else | 417 | else |
416 | { | 418 | te.DefaultTexture.MaterialID = id; |
417 | if (te.DefaultTexture.MaterialID == null) | ||
418 | m_log.Debug("[MaterialsDemoModule]: te.DefaultTexture.MaterialID is null"); | ||
419 | else | ||
420 | { | ||
421 | te.DefaultTexture.MaterialID = id; | ||
422 | } | ||
423 | } | ||
424 | } | 419 | } |
425 | else | 420 | else |
426 | { | 421 | { |
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs index c68fe99..3b3b300 100644 --- a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs +++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs | |||
@@ -263,7 +263,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport | |||
263 | m_module = module; | 263 | m_module = module; |
264 | } | 264 | } |
265 | 265 | ||
266 | public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 266 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
267 | { | 267 | { |
268 | StreamReader reader = new StreamReader(request); | 268 | StreamReader reader = new StreamReader(request); |
269 | string requestBody = reader.ReadToEnd(); | 269 | string requestBody = reader.ReadToEnd(); |
diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs index 550b5d4..8720cc7 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView | |||
55 | m_WorldViewModule = fmodule; | 55 | m_WorldViewModule = fmodule; |
56 | } | 56 | } |
57 | 57 | ||
58 | public override byte[] Handle(string path, Stream requestData, | 58 | protected override byte[] ProcessRequest(string path, Stream requestData, |
59 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 59 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
60 | { | 60 | { |
61 | httpResponse.ContentType = "image/jpeg"; | 61 | httpResponse.ContentType = "image/jpeg"; |