aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Agent
diff options
context:
space:
mode:
authorDan Lake2012-02-01 16:25:35 -0800
committerDan Lake2012-02-01 16:25:35 -0800
commitc10193c72b1f029a958f04d2f5d7ee384e693aaa (patch)
tree052ec7e973c15b158310511197affad14eb9c64f /OpenSim/Region/OptionalModules/Agent
parentTrigger event when prims are scheduled for an update. This gives modules earl... (diff)
parentSmall optimization to last commit (diff)
downloadopensim-SC-c10193c72b1f029a958f04d2f5d7ee384e693aaa.zip
opensim-SC-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.gz
opensim-SC-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.bz2
opensim-SC-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs155
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs151
3 files changed, 292 insertions, 20 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 32de85f..bbf3729 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -658,6 +658,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
658 public event ModifyTerrain OnModifyTerrain; 658 public event ModifyTerrain OnModifyTerrain;
659 public event BakeTerrain OnBakeTerrain; 659 public event BakeTerrain OnBakeTerrain;
660 public event EstateChangeInfo OnEstateChangeInfo; 660 public event EstateChangeInfo OnEstateChangeInfo;
661 public event EstateManageTelehub OnEstateManageTelehub;
661 public event SetAppearance OnSetAppearance; 662 public event SetAppearance OnSetAppearance;
662 public event AvatarNowWearing OnAvatarNowWearing; 663 public event AvatarNowWearing OnAvatarNowWearing;
663 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; 664 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
@@ -1530,6 +1531,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1530 1531
1531 } 1532 }
1532 1533
1534 public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
1535 {
1536
1537 }
1538
1533 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) 1539 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
1534 { 1540 {
1535 1541
diff --git a/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
new file mode 100644
index 0000000..439096a
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
@@ -0,0 +1,155 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Text;
33using log4net;
34using Mono.Addins;
35using Nini.Config;
36using OpenMetaverse;
37using OpenMetaverse.Imaging;
38using OpenSim.Framework;
39using OpenSim.Framework.Console;
40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes;
42
43namespace OpenSim.Region.OptionalModules.Agent.TextureSender
44{
45 /// <summary>
46 /// Commands for the J2KDecoder module. For debugging purposes.
47 /// </summary>
48 /// <remarks>
49 /// Placed here so that they can be removed if not required and to keep the J2KDecoder module itself simple.
50 /// </remarks>
51 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "J2KDecoderCommandModule")]
52 public class J2KDecoderCommandModule : ISharedRegionModule
53 {
54// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55
56 private Scene m_scene;
57
58 public string Name { get { return "Asset Information Module"; } }
59
60 public Type ReplaceableInterface { get { return null; } }
61
62 public void Initialise(IConfigSource source)
63 {
64// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: INITIALIZED MODULE");
65 }
66
67 public void PostInitialise()
68 {
69// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: POST INITIALIZED MODULE");
70 }
71
72 public void Close()
73 {
74// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: CLOSED MODULE");
75 }
76
77 public void AddRegion(Scene scene)
78 {
79// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
80 }
81
82 public void RemoveRegion(Scene scene)
83 {
84// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
85 }
86
87 public void RegionLoaded(Scene scene)
88 {
89// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
90
91 if (m_scene == null)
92 m_scene = scene;
93
94 MainConsole.Instance.Commands.AddCommand(
95 "j2k",
96 false,
97 "j2k decode",
98 "j2k decode <ID>",
99 "Do JPEG2000 decoding of an asset.",
100 "This is for debugging purposes. The asset id given must contain JPEG2000 data.",
101 HandleDecode);
102 }
103
104 void HandleDecode(string module, string[] args)
105 {
106 if (args.Length < 3)
107 {
108 MainConsole.Instance.Output("Usage is j2k decode <ID>");
109 return;
110 }
111
112 UUID assetId;
113 string rawAssetId = args[2];
114
115 if (!UUID.TryParse(rawAssetId, out assetId))
116 {
117 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId);
118 return;
119 }
120
121 AssetBase asset = m_scene.AssetService.Get(assetId.ToString());
122 if (asset == null)
123 {
124 MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId);
125 return;
126 }
127
128 if (asset.Type != (sbyte)AssetType.Texture)
129 {
130 MainConsole.Instance.OutputFormat("ERROR: Asset {0} is not a texture type", assetId);
131 return;
132 }
133
134 IJ2KDecoder decoder = m_scene.RequestModuleInterface<IJ2KDecoder>();
135 if (decoder == null)
136 {
137 MainConsole.Instance.OutputFormat("ERROR: No IJ2KDecoder module available");
138 return;
139 }
140
141 OpenJPEG.J2KLayerInfo[] layers;
142 int components;
143 if (decoder.Decode(assetId, asset.Data, out layers, out components))
144 {
145 MainConsole.Instance.OutputFormat(
146 "Successfully decoded asset {0} with {1} layers and {2} components",
147 assetId, layers.Length, components);
148 }
149 else
150 {
151 MainConsole.Instance.OutputFormat("Decode of asset {0} failed", assetId);
152 }
153 }
154 }
155} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index c754019..261029c 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -79,7 +79,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
79// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); 79// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
80 80
81 lock (m_scenes) 81 lock (m_scenes)
82 m_scenes[scene.RegionInfo.RegionID] = scene; 82 m_scenes[scene.RegionInfo.RegionID] = scene;
83
84 scene.AddCommand(
85 this, "image queues clear",
86 "image queues clear <first-name> <last-name>",
87 "Clear the image queues (textures downloaded via UDP) for a particular client.",
88 (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd)));
89
90 scene.AddCommand(
91 this, "image queues show",
92 "image queues show <first-name> <last-name>",
93 "Show the image queues (textures downloaded via UDP) for a particular client.",
94 (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
83 95
84 scene.AddCommand( 96 scene.AddCommand(
85 this, "show pqueues", 97 this, "show pqueues",
@@ -87,7 +99,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
87 "Show priority queue data for each client", 99 "Show priority queue data for each client",
88 "Without the 'full' option, only root agents are shown." 100 "Without the 'full' option, only root agents are shown."
89 + " With the 'full' option child agents are also shown.", 101 + " With the 'full' option child agents are also shown.",
90 ShowPQueuesReport); 102 (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd)));
91 103
92 scene.AddCommand( 104 scene.AddCommand(
93 this, "show queues", 105 this, "show queues",
@@ -95,7 +107,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
95 "Show queue data for each client", 107 "Show queue data for each client",
96 "Without the 'full' option, only root agents are shown." 108 "Without the 'full' option, only root agents are shown."
97 + " With the 'full' option child agents are also shown.", 109 + " With the 'full' option child agents are also shown.",
98 ShowQueuesReport); 110 (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd)));
111
112 scene.AddCommand(
113 this, "show image queues",
114 "show image queues <first-name> <last-name>",
115 "Show the image queues (textures downloaded via UDP) for a particular client.",
116 (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
99 117
100 scene.AddCommand( 118 scene.AddCommand(
101 this, "show throttles", 119 this, "show throttles",
@@ -103,14 +121,14 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
103 "Show throttle settings for each client and for the server overall", 121 "Show throttle settings for each client and for the server overall",
104 "Without the 'full' option, only root agents are shown." 122 "Without the 'full' option, only root agents are shown."
105 + " With the 'full' option child agents are also shown.", 123 + " With the 'full' option child agents are also shown.",
106 ShowThrottlesReport); 124 (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd)));
107 125
108 scene.AddCommand( 126 scene.AddCommand(
109 this, "emergency-monitoring", 127 this, "emergency-monitoring",
110 "emergency-monitoring", 128 "emergency-monitoring",
111 "Go on/off emergency monitoring mode", 129 "Go on/off emergency monitoring mode",
112 "Go on/off emergency monitoring mode", 130 "Go on/off emergency monitoring mode",
113 EmergencyMonitoring); 131 HandleEmergencyMonitoring);
114 } 132 }
115 133
116 public void RemoveRegion(Scene scene) 134 public void RemoveRegion(Scene scene)
@@ -124,24 +142,51 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
124 public void RegionLoaded(Scene scene) 142 public void RegionLoaded(Scene scene)
125 { 143 {
126// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); 144// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
127 }
128
129 protected void ShowPQueuesReport(string module, string[] cmd)
130 {
131 MainConsole.Instance.Output(GetPQueuesReport(cmd));
132 } 145 }
133 146
134 protected void ShowQueuesReport(string module, string[] cmd) 147 protected string HandleImageQueuesClear(string[] cmd)
135 {
136 MainConsole.Instance.Output(GetQueuesReport(cmd));
137 }
138
139 protected void ShowThrottlesReport(string module, string[] cmd)
140 { 148 {
141 MainConsole.Instance.Output(GetThrottlesReport(cmd)); 149 if (cmd.Length != 5)
150 return "Usage: image queues clear <first-name> <last-name>";
151
152 string firstName = cmd[3];
153 string lastName = cmd[4];
154
155 List<ScenePresence> foundAgents = new List<ScenePresence>();
156
157 lock (m_scenes)
158 {
159 foreach (Scene scene in m_scenes.Values)
160 {
161 ScenePresence sp = scene.GetScenePresence(firstName, lastName);
162 if (sp != null)
163 foundAgents.Add(sp);
164 }
165 }
166
167 if (foundAgents.Count == 0)
168 return string.Format("No agents found for {0} {1}", firstName, lastName);
169
170 StringBuilder report = new StringBuilder();
171
172 foreach (ScenePresence agent in foundAgents)
173 {
174 LLClientView client = agent.ControllingClient as LLClientView;
175
176 if (client == null)
177 return "This command is only supported for LLClientView";
178
179 int requestsDeleted = client.ImageManager.ClearImageQueue();
180
181 report.AppendFormat(
182 "In region {0} ({1} agent) cleared {2} requests\n",
183 agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", requestsDeleted);
184 }
185
186 return report.ToString();
142 } 187 }
143 188
144 protected void EmergencyMonitoring(string module, string[] cmd) 189 protected void HandleEmergencyMonitoring(string module, string[] cmd)
145 { 190 {
146 bool mode = true; 191 bool mode = true;
147 if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) 192 if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on"))
@@ -166,7 +211,6 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
166 entry.Length > maxLength ? entry.Substring(0, maxLength) : entry, 211 entry.Length > maxLength ? entry.Substring(0, maxLength) : entry,
167 ""); 212 "");
168 } 213 }
169
170 214
171 /// <summary> 215 /// <summary>
172 /// Generate UDP Queue data report for each client 216 /// Generate UDP Queue data report for each client
@@ -240,6 +284,73 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
240 284
241 return report.ToString(); 285 return report.ToString();
242 } 286 }
287
288 /// <summary>
289 /// Generate an image queue report
290 /// </summary>
291 /// <param name="showParams"></param>
292 /// <returns></returns>
293 private string GetImageQueuesReport(string[] showParams)
294 {
295 if (showParams.Length < 5 || showParams.Length > 6)
296 return "Usage: image queues show <first-name> <last-name> [full]";
297
298 string firstName = showParams[3];
299 string lastName = showParams[4];
300
301 bool showChildAgents = showParams.Length == 6;
302
303 List<ScenePresence> foundAgents = new List<ScenePresence>();
304
305 lock (m_scenes)
306 {
307 foreach (Scene scene in m_scenes.Values)
308 {
309 ScenePresence sp = scene.GetScenePresence(firstName, lastName);
310 if (sp != null && (showChildAgents || !sp.IsChildAgent))
311 foundAgents.Add(sp);
312 }
313 }
314
315 if (foundAgents.Count == 0)
316 return string.Format("No agents found for {0} {1}", firstName, lastName);
317
318 StringBuilder report = new StringBuilder();
319
320 foreach (ScenePresence agent in foundAgents)
321 {
322 LLClientView client = agent.ControllingClient as LLClientView;
323
324 if (client == null)
325 return "This command is only supported for LLClientView";
326
327 J2KImage[] images = client.ImageManager.GetImages();
328
329 report.AppendFormat(
330 "In region {0} ({1} agent)\n",
331 agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root");
332 report.AppendFormat("Images in queue: {0}\n", images.Length);
333
334 if (images.Length > 0)
335 {
336 report.AppendFormat(
337 "{0,-36} {1,-8} {2,-10} {3,-9} {4,-9} {5,-7}\n",
338 "Texture ID",
339 "Last Seq",
340 "Priority",
341 "Start Pkt",
342 "Has Asset",
343 "Decoded");
344
345 foreach (J2KImage image in images)
346 report.AppendFormat(
347 "{0,36} {1,8} {2,10} {3,10} {4,9} {5,7}\n",
348 image.TextureID, image.LastSequence, image.Priority, image.StartPacket, image.HasAsset, image.IsDecoded);
349 }
350 }
351
352 return report.ToString();
353 }
243 354
244 /// <summary> 355 /// <summary>
245 /// Generate UDP Queue data report for each client 356 /// Generate UDP Queue data report for each client