aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs173
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs8
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs18
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs16
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs47
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs97
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs41
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs53
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Perlin.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs12
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandObject.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs81
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs27
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs348
29 files changed, 691 insertions, 357 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 51eb396..ed4b620 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -283,10 +283,6 @@ namespace OpenSim
283 "kick user <first> <last> [message]", 283 "kick user <first> <last> [message]",
284 "Kick a user off the simulator", KickUserCommand); 284 "Kick a user off the simulator", KickUserCommand);
285 285
286 m_console.Commands.AddCommand("region", false, "show assets",
287 "show assets",
288 "Show asset data", HandleShow);
289
290 m_console.Commands.AddCommand("region", false, "show users", 286 m_console.Commands.AddCommand("region", false, "show users",
291 "show users [full]", 287 "show users [full]",
292 "Show user data for users currently on the region", 288 "Show user data for users currently on the region",
@@ -305,13 +301,6 @@ namespace OpenSim
305 m_console.Commands.AddCommand("region", false, "show regions", 301 m_console.Commands.AddCommand("region", false, "show regions",
306 "show regions", 302 "show regions",
307 "Show region data", HandleShow); 303 "Show region data", HandleShow);
308
309 m_console.Commands.AddCommand("region", false, "show queues",
310 "show queues [full]",
311 "Show queue data for each client",
312 "Without the 'full' option, only users actually on the region are shown."
313 + " With the 'full' option child agents of users in neighbouring regions are also shown.",
314 HandleShow);
315 304
316 m_console.Commands.AddCommand("region", false, "show ratings", 305 m_console.Commands.AddCommand("region", false, "show ratings",
317 "show ratings", 306 "show ratings",
@@ -335,16 +324,19 @@ namespace OpenSim
335 "Restart all sims in this instance", RunCommand); 324 "Restart all sims in this instance", RunCommand);
336 325
337 m_console.Commands.AddCommand("region", false, "config set", 326 m_console.Commands.AddCommand("region", false, "config set",
338 "config set <section> <field> <value>", 327 "config set <section> <key> <value>",
339 "Set a config option", HandleConfig); 328 "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig);
340 329
341 m_console.Commands.AddCommand("region", false, "config get", 330 m_console.Commands.AddCommand("region", false, "config get",
342 "config get <section> <field>", 331 "config get [<section>] [<key>]",
343 "Read a config option", HandleConfig); 332 "Show a config option",
333 "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
334 + "If a section is given but not a field, then all fields in that section are printed.",
335 HandleConfig);
344 336
345 m_console.Commands.AddCommand("region", false, "config save", 337 m_console.Commands.AddCommand("region", false, "config save",
346 "config save", 338 "config save <path>",
347 "Save current configuration", HandleConfig); 339 "Save current configuration to a file at the given path", HandleConfig);
348 340
349 m_console.Commands.AddCommand("region", false, "command-script", 341 m_console.Commands.AddCommand("region", false, "command-script",
350 "command-script <script>", 342 "command-script <script>",
@@ -586,7 +578,6 @@ namespace OpenSim
586 List<string> args = new List<string>(cmd); 578 List<string> args = new List<string>(cmd);
587 args.RemoveAt(0); 579 args.RemoveAt(0);
588 string[] cmdparams = args.ToArray(); 580 string[] cmdparams = args.ToArray();
589 string n = "CONFIG";
590 581
591 if (cmdparams.Length > 0) 582 if (cmdparams.Length > 0)
592 { 583 {
@@ -595,8 +586,8 @@ namespace OpenSim
595 case "set": 586 case "set":
596 if (cmdparams.Length < 4) 587 if (cmdparams.Length < 4)
597 { 588 {
598 MainConsole.Instance.Output(String.Format("SYNTAX: {0} SET SECTION KEY VALUE",n)); 589 Notice("Syntax: config set <section> <key> <value>");
599 MainConsole.Instance.Output(String.Format("EXAMPLE: {0} SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5",n)); 590 Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
600 } 591 }
601 else 592 else
602 { 593 {
@@ -609,48 +600,68 @@ namespace OpenSim
609 c.Set(cmdparams[2], _value); 600 c.Set(cmdparams[2], _value);
610 m_config.Source.Merge(source); 601 m_config.Source.Merge(source);
611 602
612 MainConsole.Instance.Output(String.Format("{0} {0} {1} {2} {3}",n,cmdparams[1],cmdparams[2],_value)); 603 Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value);
613 } 604 }
614 } 605 }
615 break; 606 break;
616 607
617 case "get": 608 case "get":
618 if (cmdparams.Length < 3) 609 if (cmdparams.Length == 1)
619 { 610 {
620 MainConsole.Instance.Output(String.Format("SYNTAX: {0} GET SECTION KEY",n)); 611 foreach (IConfig config in m_config.Source.Configs)
621 MainConsole.Instance.Output(String.Format("EXAMPLE: {0} GET ScriptEngine.DotNetEngine NumberOfScriptThreads",n)); 612 {
613 Notice("[{0}]", config.Name);
614 string[] keys = config.GetKeys();
615 foreach (string key in keys)
616 Notice(" {0} = {1}", key, config.GetString(key));
617 }
622 } 618 }
623 else 619 else if (cmdparams.Length == 2 || cmdparams.Length == 3)
624 { 620 {
625 IConfig c = m_config.Source.Configs[cmdparams[1]]; 621 IConfig config = m_config.Source.Configs[cmdparams[1]];
626 if (c == null) 622 if (config == null)
627 { 623 {
628 MainConsole.Instance.Output(String.Format("Section \"{0}\" does not exist.",cmdparams[1])); 624 Notice("Section \"{0}\" does not exist.",cmdparams[1]);
629 break; 625 break;
630 } 626 }
631 else 627 else
632 { 628 {
633 MainConsole.Instance.Output(String.Format("{0} GET {1} {2} : {3}",n,cmdparams[1],cmdparams[2], 629 if (cmdparams.Length == 2)
634 c.GetString(cmdparams[2]))); 630 {
631 Notice("[{0}]", config.Name);
632 foreach (string key in config.GetKeys())
633 Notice(" {0} = {1}", key, config.GetString(key));
634 }
635 else
636 {
637 Notice(
638 "config get {0} {1} : {2}",
639 cmdparams[1], cmdparams[2], config.GetString(cmdparams[2]));
640 }
635 } 641 }
636 } 642 }
643 else
644 {
645 Notice("Syntax: config get [<section>] [<key>]");
646 Notice("Example: config get ScriptEngine.DotNetEngine NumberOfScriptThreads");
647 }
637 648
638 break; 649 break;
639 650
640 case "save": 651 case "save":
641 if (cmdparams.Length < 2) 652 if (cmdparams.Length < 2)
642 { 653 {
643 MainConsole.Instance.Output("SYNTAX: " + n + " SAVE FILE"); 654 Notice("Syntax: config save <path>");
644 return; 655 return;
645 } 656 }
646 657
647 if (Application.iniFilePath == cmdparams[1]) 658 if (Application.iniFilePath == cmdparams[1])
648 { 659 {
649 MainConsole.Instance.Output("FILE can not be " + Application.iniFilePath); 660 Notice("Path can not be " + Application.iniFilePath);
650 return; 661 return;
651 } 662 }
652 663
653 MainConsole.Instance.Output("Saving configuration file: " + cmdparams[1]); 664 Notice("Saving configuration file: " + cmdparams[1]);
654 m_config.Save(cmdparams[1]); 665 m_config.Save(cmdparams[1]);
655 break; 666 break;
656 } 667 }
@@ -869,10 +880,6 @@ namespace OpenSim
869 880
870 switch (showParams[0]) 881 switch (showParams[0])
871 { 882 {
872 case "assets":
873 MainConsole.Instance.Output("Not implemented.");
874 break;
875
876 case "users": 883 case "users":
877 IList agents; 884 IList agents;
878 if (showParams.Length > 1 && showParams[1] == "full") 885 if (showParams.Length > 1 && showParams[1] == "full")
@@ -959,10 +966,6 @@ namespace OpenSim
959 }); 966 });
960 break; 967 break;
961 968
962 case "queues":
963 Notice(GetQueuesReport(showParams));
964 break;
965
966 case "ratings": 969 case "ratings":
967 m_sceneManager.ForEachScene( 970 m_sceneManager.ForEachScene(
968 delegate(Scene scene) 971 delegate(Scene scene)
@@ -990,94 +993,6 @@ namespace OpenSim
990 } 993 }
991 994
992 /// <summary> 995 /// <summary>
993 /// Generate UDP Queue data report for each client
994 /// </summary>
995 /// <param name="showParams"></param>
996 /// <returns></returns>
997 private string GetQueuesReport(string[] showParams)
998 {
999 bool showChildren = false;
1000
1001 if (showParams.Length > 1 && showParams[1] == "full")
1002 showChildren = true;
1003
1004 StringBuilder report = new StringBuilder();
1005
1006 int columnPadding = 2;
1007 int maxNameLength = 18;
1008 int maxRegionNameLength = 14;
1009 int maxTypeLength = 4;
1010 int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
1011
1012 report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", "");
1013 report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", "");
1014 report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type", "");
1015
1016 report.AppendFormat(
1017 "{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
1018 "Packets",
1019 "Packets",
1020 "Bytes",
1021 "Bytes",
1022 "Bytes",
1023 "Bytes",
1024 "Bytes",
1025 "Bytes",
1026 "Bytes",
1027 "Bytes",
1028 "Bytes");
1029
1030 report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
1031 report.AppendFormat(
1032 "{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
1033 "Out",
1034 "In",
1035 "Unacked",
1036 "Resend",
1037 "Land",
1038 "Wind",
1039 "Cloud",
1040 "Task",
1041 "Texture",
1042 "Asset",
1043 "State");
1044
1045 m_sceneManager.ForEachScene(
1046 delegate(Scene scene)
1047 {
1048 scene.ForEachClient(
1049 delegate(IClientAPI client)
1050 {
1051 if (client is IStatsCollector)
1052 {
1053 bool isChild = scene.PresenceChildStatus(client.AgentId);
1054 if (isChild && !showChildren)
1055 return;
1056
1057 string name = client.Name;
1058 string regionName = scene.RegionInfo.RegionName;
1059
1060 report.AppendFormat(
1061 "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}",
1062 name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, "");
1063 report.AppendFormat(
1064 "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}",
1065 regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, "");
1066 report.AppendFormat(
1067 "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}",
1068 isChild ? "Cd" : "Rt", "");
1069
1070 IStatsCollector stats = (IStatsCollector)client;
1071
1072 report.AppendLine(stats.Report());
1073 }
1074 });
1075 });
1076
1077 return report.ToString();
1078 }
1079
1080 /// <summary>
1081 /// Use XML2 format to serialize data to a file 996 /// Use XML2 format to serialize data to a file
1082 /// </summary> 997 /// </summary>
1083 /// <param name="module"></param> 998 /// <param name="module"></param>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index ee4f04e..5dab1bc 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -368,6 +368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
368 #region Properties 368 #region Properties
369 369
370 public LLUDPClient UDPClient { get { return m_udpClient; } } 370 public LLUDPClient UDPClient { get { return m_udpClient; } }
371 public LLUDPServer UDPServer { get { return m_udpServer; } }
371 public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } } 372 public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } }
372 public UUID SecureSessionId { get { return m_secureSessionId; } } 373 public UUID SecureSessionId { get { return m_secureSessionId; } }
373 public IScene Scene { get { return m_scene; } } 374 public IScene Scene { get { return m_scene; } }
@@ -3465,9 +3466,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3465 ani.AnimationList[i].AnimSequenceID = seqs[i]; 3466 ani.AnimationList[i].AnimSequenceID = seqs[i];
3466 3467
3467 ani.AnimationSourceList[i] = new AvatarAnimationPacket.AnimationSourceListBlock(); 3468 ani.AnimationSourceList[i] = new AvatarAnimationPacket.AnimationSourceListBlock();
3468 ani.AnimationSourceList[i].ObjectID = objectIDs[i]; 3469 if (objectIDs[i].Equals(sourceAgentId))
3469 if (objectIDs[i] == UUID.Zero) 3470 ani.AnimationSourceList[i].ObjectID = UUID.Zero;
3470 ani.AnimationSourceList[i].ObjectID = sourceAgentId; 3471 else
3472 ani.AnimationSourceList[i].ObjectID = objectIDs[i];
3471 } 3473 }
3472 ani.Header.Reliable = false; 3474 ani.Header.Reliable = false;
3473 OutPacket(ani, ThrottleOutPacketType.Task); 3475 OutPacket(ani, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index e02783a..d4c3307 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -256,18 +256,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
256 public string GetStats() 256 public string GetStats()
257 { 257 {
258 return string.Format( 258 return string.Format(
259 "{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}", 259 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}",
260 PacketsSent, 260 PacketsSent,
261 PacketsReceived, 261 PacketsReceived,
262 UnackedBytes, 262 UnackedBytes,
263 m_throttleCategories[(int)ThrottleOutPacketType.Resend].Content, 263 m_packetOutboxes[(int)ThrottleOutPacketType.Resend].Count,
264 m_throttleCategories[(int)ThrottleOutPacketType.Land].Content, 264 m_packetOutboxes[(int)ThrottleOutPacketType.Land].Count,
265 m_throttleCategories[(int)ThrottleOutPacketType.Wind].Content, 265 m_packetOutboxes[(int)ThrottleOutPacketType.Wind].Count,
266 m_throttleCategories[(int)ThrottleOutPacketType.Cloud].Content, 266 m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count,
267 m_throttleCategories[(int)ThrottleOutPacketType.Task].Content, 267 m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count,
268 m_throttleCategories[(int)ThrottleOutPacketType.Texture].Content, 268 m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count,
269 m_throttleCategories[(int)ThrottleOutPacketType.Asset].Content, 269 m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count,
270 m_throttleCategories[(int)ThrottleOutPacketType.State].Content); 270 m_packetOutboxes[(int)ThrottleOutPacketType.State].Count);
271 } 271 }
272 272
273 public void SendPacketStats() 273 public void SendPacketStats()
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index e54cfc2..df8ddbb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -114,8 +114,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
114 //private UDPClientCollection m_clients = new UDPClientCollection(); 114 //private UDPClientCollection m_clients = new UDPClientCollection();
115 /// <summary>Bandwidth throttle for this UDP server</summary> 115 /// <summary>Bandwidth throttle for this UDP server</summary>
116 protected TokenBucket m_throttle; 116 protected TokenBucket m_throttle;
117
117 /// <summary>Bandwidth throttle rates for this UDP server</summary> 118 /// <summary>Bandwidth throttle rates for this UDP server</summary>
118 protected ThrottleRates m_throttleRates; 119 public ThrottleRates ThrottleRates { get; private set; }
120
119 /// <summary>Manages authentication for agent circuits</summary> 121 /// <summary>Manages authentication for agent circuits</summary>
120 private AgentCircuitManager m_circuitManager; 122 private AgentCircuitManager m_circuitManager;
121 /// <summary>Reference to the scene this UDP server is attached to</summary> 123 /// <summary>Reference to the scene this UDP server is attached to</summary>
@@ -226,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
226 #endregion BinaryStats 228 #endregion BinaryStats
227 229
228 m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps); 230 m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps);
229 m_throttleRates = new ThrottleRates(configSource); 231 ThrottleRates = new ThrottleRates(configSource);
230 } 232 }
231 233
232 public void Start() 234 public void Start()
@@ -585,8 +587,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
585 587
586 // Stats tracking 588 // Stats tracking
587 Interlocked.Increment(ref udpClient.PacketsSent); 589 Interlocked.Increment(ref udpClient.PacketsSent);
588 if (isReliable)
589 Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength);
590 590
591 // Put the UDP payload on the wire 591 // Put the UDP payload on the wire
592 AsyncBeginSend(buffer); 592 AsyncBeginSend(buffer);
@@ -859,9 +859,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
859 // Acknowledge the UseCircuitCode packet 859 // Acknowledge the UseCircuitCode packet
860 SendAckImmediate(remoteEndPoint, packet.Header.Sequence); 860 SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
861 861
862 m_log.DebugFormat( 862// m_log.DebugFormat(
863 "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 863// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
864 buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 864// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
865 } 865 }
866 866
867 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber) 867 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
@@ -924,7 +924,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
924 protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) 924 protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
925 { 925 {
926 // Create the LLUDPClient 926 // Create the LLUDPClient
927 LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 927 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
928 IClientAPI existingClient; 928 IClientAPI existingClient;
929 929
930 if (!m_scene.TryGetClient(agentID, out existingClient)) 930 if (!m_scene.TryGetClient(agentID, out existingClient))
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index 4cb4aee..9d40688 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Threading;
31using OpenMetaverse; 32using OpenMetaverse;
32 33
33namespace OpenSim.Region.ClientStack.LindenUDP 34namespace OpenSim.Region.ClientStack.LindenUDP
@@ -77,6 +78,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
77 public void Add(OutgoingPacket packet) 78 public void Add(OutgoingPacket packet)
78 { 79 {
79 m_pendingAdds.Enqueue(packet); 80 m_pendingAdds.Enqueue(packet);
81 Interlocked.Add(ref packet.Client.UnackedBytes, packet.Buffer.DataLength);
80 } 82 }
81 83
82 /// <summary> 84 /// <summary>
@@ -139,46 +141,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
139 private void ProcessQueues() 141 private void ProcessQueues()
140 { 142 {
141 // Process all the pending adds 143 // Process all the pending adds
142
143 OutgoingPacket pendingAdd; 144 OutgoingPacket pendingAdd;
144 if (m_pendingAdds != null) 145 while (m_pendingAdds.TryDequeue(out pendingAdd))
145 { 146 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
146 while (m_pendingAdds.TryDequeue(out pendingAdd))
147 {
148 if (pendingAdd != null && m_packets != null)
149 {
150 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
151 }
152 }
153 }
154 147
155 // Process all the pending removes, including updating statistics and round-trip times 148 // Process all the pending removes, including updating statistics and round-trip times
156 PendingAck pendingRemove; 149 PendingAck pendingRemove;
157 OutgoingPacket ackedPacket; 150 OutgoingPacket ackedPacket;
158 if (m_pendingRemoves != null) 151 while (m_pendingRemoves.TryDequeue(out pendingRemove))
159 { 152 {
160 while (m_pendingRemoves.TryDequeue(out pendingRemove)) 153 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
161 { 154 {
162 if (m_pendingRemoves != null && m_packets != null) 155 m_packets.Remove(pendingRemove.SequenceNumber);
156
157 // Update stats
158 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
159
160 if (!pendingRemove.FromResend)
163 { 161 {
164 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 162 // Calculate the round-trip time for this packet and its ACK
165 { 163 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
166 m_packets.Remove(pendingRemove.SequenceNumber); 164 if (rtt > 0)
167 165 ackedPacket.Client.UpdateRoundTrip(rtt);
168 // Update stats
169 System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
170
171 if (!pendingRemove.FromResend)
172 {
173 // Calculate the round-trip time for this packet and its ACK
174 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
175 if (rtt > 0)
176 ackedPacket.Client.UpdateRoundTrip(rtt);
177 }
178 }
179 } 166 }
180 } 167 }
181 } 168 }
182 } 169 }
183 } 170 }
184} 171} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index c66a4ea..771038e 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -41,8 +41,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
41 /// </summary> 41 /// </summary>
42 public class AgentAssetTransactions 42 public class AgentAssetTransactions
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger( 44// private static readonly ILog m_log = LogManager.GetLogger(
45 MethodBase.GetCurrentMethod().DeclaringType); 45// MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 // Fields 47 // Fields
48 private bool m_dumpAssetsToFile; 48 private bool m_dumpAssetsToFile;
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
index 36aaab3..878242a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
@@ -49,8 +49,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class GetMeshModule : INonSharedRegionModule 50 public class GetMeshModule : INonSharedRegionModule
51 { 51 {
52 private static readonly ILog m_log = 52// private static readonly ILog m_log =
53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
54 private Scene m_scene; 55 private Scene m_scene;
55 private IAssetService m_assetService; 56 private IAssetService m_assetService;
56 57
@@ -102,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
102 { 103 {
103 UUID capID = UUID.Random(); 104 UUID capID = UUID.Random();
104 105
105 m_log.Info("[GETMESH]: /CAPS/" + capID); 106// m_log.Info("[GETMESH]: /CAPS/" + capID);
106 caps.RegisterHandler("GetMesh", 107 caps.RegisterHandler("GetMesh",
107 new RestHTTPHandler("GET", "/CAPS/" + capID, 108 new RestHTTPHandler("GET", "/CAPS/" + capID,
108 delegate(Hashtable m_dhttpMethod) 109 delegate(Hashtable m_dhttpMethod)
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
index 1f60e36..6fb8b46 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
105 { 105 {
106 UUID capID = UUID.Random(); 106 UUID capID = UUID.Random();
107 107
108 m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 108// m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
109 caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 109 caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
110 } 110 }
111 111
@@ -171,7 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
171 /// <returns>False for "caller try another codec"; true otherwise</returns> 171 /// <returns>False for "caller try another codec"; true otherwise</returns>
172 private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format) 172 private bool FetchTexture(OSHttpRequest httpRequest, OSHttpResponse httpResponse, UUID textureID, string format)
173 { 173 {
174 m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format); 174// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
175 AssetBase texture; 175 AssetBase texture;
176 176
177 string fullID = textureID.ToString(); 177 string fullID = textureID.ToString();
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
index af26b2b..542af25 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
@@ -50,8 +50,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule 51 public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
52 { 52 {
53 private static readonly ILog m_log = 53// private static readonly ILog m_log =
54 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55
55 private Scene m_scene; 56 private Scene m_scene;
56 private IAssetService m_assetService; 57 private IAssetService m_assetService;
57 private bool m_dumpAssetsToFile = false; 58 private bool m_dumpAssetsToFile = false;
@@ -104,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
104 { 105 {
105 UUID capID = UUID.Random(); 106 UUID capID = UUID.Random();
106 107
107 m_log.Info("[GETMESH]: /CAPS/" + capID); 108// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID);
108 caps.RegisterHandler("NewFileAgentInventoryVariablePrice", 109 caps.RegisterHandler("NewFileAgentInventoryVariablePrice",
109 110
110 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST", 111 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST",
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 360a014..ff26264 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -132,8 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
132 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId 132 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
133 + ", AttachmentPoint: " + AttachmentPt); 133 + ", AttachmentPoint: " + AttachmentPt);
134 134
135 if (m_scene.AvatarFactory != null)
136 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
137 } 135 }
138 } 136 }
139 catch (Exception e) 137 catch (Exception e)
@@ -336,7 +334,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
336 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 334 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
337 item = m_scene.InventoryService.GetItem(item); 335 item = m_scene.InventoryService.GetItem(item);
338 336
339 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 337 bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
338 if (changed && m_scene.AvatarFactory != null)
339 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
340 } 340 }
341 341
342 return att.UUID; 342 return att.UUID;
@@ -380,9 +380,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
380 // XXYY!! 380 // XXYY!!
381 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 381 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
382 item = m_scene.InventoryService.GetItem(item); 382 item = m_scene.InventoryService.GetItem(item);
383 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); 383 bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
384 384 if (changed && m_scene.AvatarFactory != null)
385 if (m_scene.AvatarFactory != null)
386 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 385 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
387 } 386 }
388 } 387 }
@@ -402,11 +401,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
402 ScenePresence presence; 401 ScenePresence presence;
403 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 402 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
404 { 403 {
405 presence.Appearance.DetachAttachment(itemID);
406
407 // Save avatar attachment information 404 // Save avatar attachment information
408 m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); 405 m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
409 if (m_scene.AvatarFactory != null) 406
407 bool changed = presence.Appearance.DetachAttachment(itemID);
408 if (changed && m_scene.AvatarFactory != null)
410 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 409 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
411 } 410 }
412 411
@@ -431,9 +430,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
431 part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) 430 part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
432 return; 431 return;
433 432
434 presence.Appearance.DetachAttachment(itemID); 433 bool changed = presence.Appearance.DetachAttachment(itemID);
435 434 if (changed && m_scene.AvatarFactory != null)
436 if (m_scene.AvatarFactory != null)
437 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 435 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
438 436
439 part.ParentGroup.DetachToGround(); 437 part.ParentGroup.DetachToGround();
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 7d6d191..f8ce444 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
167 } 167 }
168 } 168 }
169 169
170 m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}",client.AgentId); 170 m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId);
171 171
172 // If we only found default textures, then the appearance is not cached 172 // If we only found default textures, then the appearance is not cached
173 return (defonly ? false : true); 173 return (defonly ? false : true);
@@ -187,7 +187,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
187 return; 187 return;
188 } 188 }
189 189
190 m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}",client.AgentId); 190// m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}", client.AgentId);
191 191
192 // TODO: This is probably not necessary any longer, just assume the 192 // TODO: This is probably not necessary any longer, just assume the
193 // textureEntry set implies that the appearance transaction is complete 193 // textureEntry set implies that the appearance transaction is complete
@@ -210,14 +210,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
210 { 210 {
211 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 211 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
212 212
213 m_log.InfoFormat("[AVFACTORY]: received texture update for {0}",client.AgentId); 213 m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", client.AgentId);
214 Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); }); 214 Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); });
215 215
216 // This appears to be set only in the final stage of the appearance 216 // This appears to be set only in the final stage of the appearance
217 // update transaction. In theory, we should be able to do an immediate 217 // update transaction. In theory, we should be able to do an immediate
218 // appearance send and save here. 218 // appearance send and save here.
219 219
220 QueueAppearanceSave(client.AgentId); 220 // save only if there were changes, send no matter what (doesn't hurt to send twice)
221 if (changed)
222 QueueAppearanceSave(client.AgentId);
221 QueueAppearanceSend(client.AgentId); 223 QueueAppearanceSend(client.AgentId);
222 } 224 }
223 225
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
index 7303fe7..7df2beb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
69 item = invService.GetItem(item); 69 item = invService.GetItem(item);
70 if (item != null) 70 if (item != null)
71 { 71 {
72 item.Flags = 1; 72 item.Flags |= 1;
73 invService.UpdateItem(item); 73 invService.UpdateItem(item);
74 } 74 }
75 else 75 else
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
85 item = invService.GetItem(item); 85 item = invService.GetItem(item);
86 if (item != null) 86 if (item != null)
87 { 87 {
88 item.Flags = 0; 88 item.Flags &= ~(uint)1;
89 invService.UpdateItem(item); 89 invService.UpdateItem(item);
90 } 90 }
91 else 91 else
@@ -93,4 +93,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
93 "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name); 93 "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
94 } 94 }
95 } 95 }
96} \ No newline at end of file 96}
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 21a61a7..77c7147 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
146 if (!user.IsChildAgent) 146 if (!user.IsChildAgent)
147 { 147 {
148 // Local message 148 // Local message
149 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); 149// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
150 user.ControllingClient.SendInstantMessage(im); 150 user.ControllingClient.SendInstantMessage(im);
151 151
152 // Message sent 152 // Message sent
@@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
168 // Local message 168 // Local message
169 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 169 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
170 170
171 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); 171// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
172 user.ControllingClient.SendInstantMessage(im); 172 user.ControllingClient.SendInstantMessage(im);
173 173
174 // Message sent 174 // Message sent
@@ -177,7 +177,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
177 } 177 }
178 } 178 }
179 179
180 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 180// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
181 SendGridInstantMessageViaXMLRPC(im, result); 181 SendGridInstantMessageViaXMLRPC(im, result);
182 182
183 return; 183 return;
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
index c011776..a0d72ed 100644
--- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
@@ -43,8 +43,9 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
43{ 43{
44 public class ObjectAdd : IRegionModule 44 public class ObjectAdd : IRegionModule
45 { 45 {
46 private static readonly ILog m_log = 46// private static readonly ILog m_log =
47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
48 private Scene m_scene; 49 private Scene m_scene;
49 #region IRegionModule Members 50 #region IRegionModule Members
50 51
@@ -63,7 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
63 { 64 {
64 UUID capuuid = UUID.Random(); 65 UUID capuuid = UUID.Random();
65 66
66 m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/"); 67// m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/");
67 68
68 caps.RegisterHandler("ObjectAdd", 69 caps.RegisterHandler("ObjectAdd",
69 new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/", 70 new RestHTTPHandler("POST", "/CAPS/OA/" + capuuid + "/",
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs
index 09b9719..3114d7f 100644
--- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
105 { 105 {
106 UUID capID = UUID.Random(); 106 UUID capID = UUID.Random();
107 107
108 m_log.Info("[UploadObjectAssetModule]: /CAPS/" + capID); 108// m_log.Debug("[UPLOAD OBJECT ASSET MODULE]: /CAPS/" + capID);
109 caps.RegisterHandler("UploadObjectAsset", 109 caps.RegisterHandler("UploadObjectAsset",
110 new RestHTTPHandler("POST", "/CAPS/OA/" + capID + "/", 110 new RestHTTPHandler("POST", "/CAPS/OA/" + capID + "/",
111 delegate(Hashtable m_dhttpMethod) 111 delegate(Hashtable m_dhttpMethod)
@@ -156,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
156 } 156 }
157 catch (Exception ex) 157 catch (Exception ex)
158 { 158 {
159 m_log.Error("[UploadObjectAssetModule]: Error deserializing message " + ex.ToString()); 159 m_log.Error("[UPLOAD OBJECT ASSET MODULE]: Error deserializing message " + ex.ToString());
160 message = null; 160 message = null;
161 } 161 }
162 162
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
174 Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation); 174 Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation);
175 Quaternion rot = Quaternion.Identity; 175 Quaternion rot = Quaternion.Identity;
176 Vector3 rootpos = Vector3.Zero; 176 Vector3 rootpos = Vector3.Zero;
177 Quaternion rootrot = Quaternion.Identity; 177// Quaternion rootrot = Quaternion.Identity;
178 178
179 SceneObjectGroup rootGroup = null; 179 SceneObjectGroup rootGroup = null;
180 SceneObjectGroup[] allparts = new SceneObjectGroup[message.Objects.Length]; 180 SceneObjectGroup[] allparts = new SceneObjectGroup[message.Objects.Length];
@@ -186,11 +186,9 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
186 if (i == 0) 186 if (i == 0)
187 { 187 {
188 rootpos = obj.Position; 188 rootpos = obj.Position;
189 rootrot = obj.Rotation; 189// rootrot = obj.Rotation;
190
191 } 190 }
192 191
193
194 // Combine the extraparams data into it's ugly blob again.... 192 // Combine the extraparams data into it's ugly blob again....
195 //int bytelength = 0; 193 //int bytelength = 0;
196 //for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++) 194 //for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++)
@@ -363,9 +361,8 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
363 responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(allparts[0].LocalId)); 361 responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(allparts[0].LocalId));
364 362
365 return responsedata; 363 return responsedata;
366
367
368 } 364 }
365
369 private string ConvertUintToBytes(uint val) 366 private string ConvertUintToBytes(uint val)
370 { 367 {
371 byte[] resultbytes = Utils.UIntToBytes(val); 368 byte[] resultbytes = Utils.UIntToBytes(val);
@@ -374,4 +371,4 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
374 return String.Format("<binary encoding=\"base64\">{0}</binary>", Convert.ToBase64String(resultbytes)); 371 return String.Format("<binary encoding=\"base64\">{0}</binary>", Convert.ToBase64String(resultbytes));
375 } 372 }
376 } 373 }
377} 374} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index ddae20f..b0563c5 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -767,6 +767,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
767 LookupUUIDS icon = (LookupUUIDS)iar.AsyncState; 767 LookupUUIDS icon = (LookupUUIDS)iar.AsyncState;
768 icon.EndInvoke(iar); 768 icon.EndInvoke(iar);
769 } 769 }
770
770 private void LookupUUID(List<UUID> uuidLst) 771 private void LookupUUID(List<UUID> uuidLst)
771 { 772 {
772 LookupUUIDS d = LookupUUIDsAsync; 773 LookupUUIDS d = LookupUUIDsAsync;
@@ -775,6 +776,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
775 LookupUUIDSCompleted, 776 LookupUUIDSCompleted,
776 d); 777 d);
777 } 778 }
779
778 private void LookupUUIDsAsync(List<UUID> uuidLst) 780 private void LookupUUIDsAsync(List<UUID> uuidLst)
779 { 781 {
780 UUID[] uuidarr; 782 UUID[] uuidarr;
@@ -789,12 +791,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
789 // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); 791 // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
790 792
791 IUserManagement userManager = m_scene.RequestModuleInterface<IUserManagement>(); 793 IUserManagement userManager = m_scene.RequestModuleInterface<IUserManagement>();
792 string userName = "Unkown User";
793 if (userManager != null) 794 if (userManager != null)
794 userName = userManager.GetUserName(uuidarr[i]); 795 userManager.GetUserName(uuidarr[i]);
795 796
796 // we drop it. It gets cached though... so we're ready for the next request. 797 // we drop it. It gets cached though... so we're ready for the next request.
797 // diva commnent 11/21/2010: uh?!? wft? 798 // diva commnent 11/21/2010: uh?!? wft?
799 // justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume.
798 } 800 }
799 } 801 }
800 #endregion 802 #endregion
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index 1ad4db2..9e27ef0 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land
64 #endregion 64 #endregion
65 65
66 private readonly Scene m_scene; 66 private readonly Scene m_scene;
67 private readonly LandManagementModule m_landManagementModule; 67 private readonly LandManagementModule m_landManagementModule;
68 68
69 public LandChannel(Scene scene, LandManagementModule landManagementMod) 69 public LandChannel(Scene scene, LandManagementModule landManagementMod)
70 { 70 {
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 4f8e205..70767f7 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics; 31using System.Diagnostics;
32using System.Reflection; 32using System.Reflection;
33using System.Text;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -37,19 +38,22 @@ using OpenMetaverse.StructuredData;
37using OpenMetaverse.Messages.Linden; 38using OpenMetaverse.Messages.Linden;
38using OpenSim.Framework; 39using OpenSim.Framework;
39using OpenSim.Framework.Capabilities; 40using OpenSim.Framework.Capabilities;
41using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers; 42using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Services.Interfaces; 44using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
43using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.Physics.Manager;
46using Caps=OpenSim.Framework.Capabilities.Caps; 48using OpenSim.Services.Interfaces;
49using Caps = OpenSim.Framework.Capabilities.Caps;
47using GridRegion = OpenSim.Services.Interfaces.GridRegion; 50using GridRegion = OpenSim.Services.Interfaces.GridRegion;
48 51
49namespace OpenSim.Region.CoreModules.World.Land 52namespace OpenSim.Region.CoreModules.World.Land
50{ 53{
51 // used for caching 54 // used for caching
52 internal class ExtendedLandData { 55 internal class ExtendedLandData
56 {
53 public LandData LandData; 57 public LandData LandData;
54 public ulong RegionHandle; 58 public ulong RegionHandle;
55 public uint X, Y; 59 public uint X, Y;
@@ -65,6 +69,9 @@ namespace OpenSim.Region.CoreModules.World.Land
65 69
66 private LandChannel landChannel; 70 private LandChannel landChannel;
67 private Scene m_scene; 71 private Scene m_scene;
72 protected Commander m_commander = new Commander("land");
73
74 protected IUserManagement m_userManager;
68 75
69 // Minimum for parcels to work is 64m even if we don't actually use them. 76 // Minimum for parcels to work is 64m even if we don't actually use them.
70 #pragma warning disable 0429 77 #pragma warning disable 0429
@@ -127,19 +134,27 @@ namespace OpenSim.Region.CoreModules.World.Land
127 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; 134 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
128 m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; 135 m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted;
129 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; 136 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
137 m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
130 138
131 lock (m_scene) 139 lock (m_scene)
132 { 140 {
133 m_scene.LandChannel = (ILandChannel)landChannel; 141 m_scene.LandChannel = (ILandChannel)landChannel;
134 } 142 }
143
144 InstallInterfaces();
135 } 145 }
136 146
137 public void RegionLoaded(Scene scene) 147 public void RegionLoaded(Scene scene)
138 { 148 {
149 m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
139 } 150 }
140 151
141 public void RemoveRegion(Scene scene) 152 public void RemoveRegion(Scene scene)
142 { 153 {
154 // TODO: Also release other event manager listeners here
155
156 m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
157 m_scene.UnregisterModuleCommander(m_commander.Name);
143 } 158 }
144 159
145// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) 160// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
@@ -148,6 +163,29 @@ namespace OpenSim.Region.CoreModules.World.Land
148// reason = "You are not allowed to enter this sim."; 163// reason = "You are not allowed to enter this sim.";
149// return nearestParcel != null; 164// return nearestParcel != null;
150// } 165// }
166
167 /// <summary>
168 /// Processes commandline input. Do not call directly.
169 /// </summary>
170 /// <param name="args">Commandline arguments</param>
171 protected void EventManagerOnPluginConsole(string[] args)
172 {
173 if (args[0] == "land")
174 {
175 if (args.Length == 1)
176 {
177 m_commander.ProcessConsoleCommand("help", new string[0]);
178 return;
179 }
180
181 string[] tmpArgs = new string[args.Length - 2];
182 int i;
183 for (i = 2; i < args.Length; i++)
184 tmpArgs[i - 2] = args[i];
185
186 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
187 }
188 }
151 189
152 void EventManagerOnNewClient(IClientAPI client) 190 void EventManagerOnNewClient(IClientAPI client)
153 { 191 {
@@ -209,11 +247,6 @@ namespace OpenSim.Region.CoreModules.World.Land
209 } 247 }
210 } 248 }
211 249
212
213 public void PostInitialise()
214 {
215 }
216
217 public void Close() 250 public void Close()
218 { 251 {
219 } 252 }
@@ -223,11 +256,6 @@ namespace OpenSim.Region.CoreModules.World.Land
223 get { return "LandManagementModule"; } 256 get { return "LandManagementModule"; }
224 } 257 }
225 258
226 public bool IsSharedModule
227 {
228 get { return false; }
229 }
230
231 #endregion 259 #endregion
232 260
233 #region Parcel Add/Remove/Get/Create 261 #region Parcel Add/Remove/Get/Create
@@ -1591,5 +1619,44 @@ namespace OpenSim.Region.CoreModules.World.Land
1591 1619
1592 UpdateLandObject(localID, land.LandData); 1620 UpdateLandObject(localID, land.LandData);
1593 } 1621 }
1622
1623 protected void InstallInterfaces()
1624 {
1625 Command showCommand =
1626 new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the current region.");
1627
1628 m_commander.RegisterCommand("show", showCommand);
1629
1630 // Add this to our scene so scripts can call these functions
1631 m_scene.RegisterModuleCommander(m_commander);
1632 }
1633
1634 protected void ShowParcelsCommand(Object[] args)
1635 {
1636 StringBuilder report = new StringBuilder();
1637
1638 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
1639 report.AppendFormat(
1640 "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n",
1641 "Parcel Name",
1642 "Area",
1643 "Starts",
1644 "Ends",
1645 "Owner");
1646
1647 lock (m_landList)
1648 {
1649 foreach (ILandObject lo in m_landList.Values)
1650 {
1651 LandData ld = lo.LandData;
1652
1653 report.AppendFormat(
1654 "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n",
1655 ld.Name, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID));
1656 }
1657 }
1658
1659 MainConsole.Instance.Output(report.ToString());
1660 }
1594 } 1661 }
1595} 1662} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 3e41c55..b90e307 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -77,7 +77,43 @@ namespace OpenSim.Region.CoreModules.World.Land
77 { 77 {
78 get { return m_scene.RegionInfo.RegionID; } 78 get { return m_scene.RegionInfo.RegionID; }
79 } 79 }
80 80
81 public Vector3 StartPoint
82 {
83 get
84 {
85 for (int y = 0; y < landArrayMax; y++)
86 {
87 for (int x = 0; x < landArrayMax; x++)
88 {
89 if (LandBitmap[x, y])
90 return new Vector3(x * 4, y * 4, 0);
91 }
92 }
93
94 return new Vector3(-1, -1, -1);
95 }
96 }
97
98 public Vector3 EndPoint
99 {
100 get
101 {
102 for (int y = landArrayMax - 1; y >= 0; y--)
103 {
104 for (int x = landArrayMax - 1; x >= 0; x--)
105 {
106 if (LandBitmap[x, y])
107 {
108 return new Vector3(x * 4, y * 4, 0);
109 }
110 }
111 }
112
113 return new Vector3(-1, -1, -1);
114 }
115 }
116
81 #region Constructors 117 #region Constructors
82 118
83 public LandObject(UUID owner_id, bool is_group_owned, Scene scene) 119 public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
@@ -96,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Land
96 #region Member Functions 132 #region Member Functions
97 133
98 #region General Functions 134 #region General Functions
99 135
100 /// <summary> 136 /// <summary>
101 /// Checks to see if this land object contains a point 137 /// Checks to see if this land object contains a point
102 /// </summary> 138 /// </summary>
@@ -217,6 +253,7 @@ namespace OpenSim.Region.CoreModules.World.Land
217 ParcelFlags.AllowDamage | 253 ParcelFlags.AllowDamage |
218 ParcelFlags.CreateObjects | 254 ParcelFlags.CreateObjects |
219 ParcelFlags.RestrictPushObject | 255 ParcelFlags.RestrictPushObject |
256 ParcelFlags.AllowOtherScripts |
220 ParcelFlags.AllowGroupScripts | 257 ParcelFlags.AllowGroupScripts |
221 ParcelFlags.CreateGroupObjects | 258 ParcelFlags.CreateGroupObjects |
222 ParcelFlags.AllowAPrimitiveEntry | 259 ParcelFlags.AllowAPrimitiveEntry |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
index ec97acd..0e861a1 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private Commander m_commander = new Commander("export"); 49// private Commander m_commander = new Commander("export");
50 private List<Scene> m_regions = new List<Scene>(); 50 private List<Scene> m_regions = new List<Scene>();
51 private string m_savedir = "exports"; 51 private string m_savedir = "exports";
52 private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>(); 52 private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
@@ -77,14 +77,13 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
77 m_serialisers.Add(new SerialiseObjects()); 77 m_serialisers.Add(new SerialiseObjects());
78 } 78 }
79 79
80 LoadCommanderCommands(); 80// LoadCommanderCommands();
81 } 81 }
82 82
83
84 public void AddRegion(Scene scene) 83 public void AddRegion(Scene scene)
85 { 84 {
86 scene.RegisterModuleCommander(m_commander); 85// scene.RegisterModuleCommander(m_commander);
87 scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 86// scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
88 scene.RegisterModuleInterface<IRegionSerialiserModule>(this); 87 scene.RegisterModuleInterface<IRegionSerialiserModule>(this);
89 88
90 lock (m_regions) 89 lock (m_regions)
@@ -211,18 +210,18 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
211 210
212 #endregion 211 #endregion
213 212
214 private void EventManager_OnPluginConsole(string[] args) 213// private void EventManager_OnPluginConsole(string[] args)
215 { 214// {
216 if (args[0] == "export") 215// if (args[0] == "export")
217 { 216// {
218 string[] tmpArgs = new string[args.Length - 2]; 217// string[] tmpArgs = new string[args.Length - 2];
219 int i = 0; 218// int i = 0;
220 for (i = 2; i < args.Length; i++) 219// for (i = 2; i < args.Length; i++)
221 tmpArgs[i - 2] = args[i]; 220// tmpArgs[i - 2] = args[i];
222 221//
223 m_commander.ProcessConsoleCommand(args[1], tmpArgs); 222// m_commander.ProcessConsoleCommand(args[1], tmpArgs);
224 } 223// }
225 } 224// }
226 225
227 private void InterfaceSaveRegion(Object[] args) 226 private void InterfaceSaveRegion(Object[] args)
228 { 227 {
@@ -245,15 +244,15 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
245 } 244 }
246 } 245 }
247 246
248 private void LoadCommanderCommands() 247// private void LoadCommanderCommands()
249 { 248// {
250 Command serialiseSceneCommand = new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveRegion, "Saves the named region into the exports directory."); 249// Command serialiseSceneCommand = new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveRegion, "Saves the named region into the exports directory.");
251 serialiseSceneCommand.AddArgument("region-name", "The name of the region you wish to export", "String"); 250// serialiseSceneCommand.AddArgument("region-name", "The name of the region you wish to export", "String");
252 251//
253 Command serialiseAllScenesCommand = new Command("save-all",CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveAllRegions, "Saves all regions into the exports directory."); 252// Command serialiseAllScenesCommand = new Command("save-all",CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveAllRegions, "Saves all regions into the exports directory.");
254 253//
255 m_commander.RegisterCommand("save", serialiseSceneCommand); 254// m_commander.RegisterCommand("save", serialiseSceneCommand);
256 m_commander.RegisterCommand("save-all", serialiseAllScenesCommand); 255// m_commander.RegisterCommand("save-all", serialiseAllScenesCommand);
257 } 256// }
258 } 257 }
259} 258}
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 8df44fe..09c0ebb 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
38{ 38{
39 public class SoundModule : IRegionModule, ISoundModule 39 public class SoundModule : IRegionModule, ISoundModule
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 protected Scene m_scene; 43 protected Scene m_scene;
44 44
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Perlin.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Perlin.cs
index af59d7a..522a7eb 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Perlin.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Perlin.cs
@@ -85,9 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
85 public static float noise1(float arg) 85 public static float noise1(float arg)
86 { 86 {
87 int bx0, bx1; 87 int bx0, bx1;
88 float rx0, rx1, sx, t, u, v, a; 88 float rx0, rx1, sx, t, u, v;
89
90 a = arg;
91 89
92 t = arg + N; 90 t = arg + N;
93 bx0 = ((int)t) & BM; 91 bx0 = ((int)t) & BM;
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f9d28b9..e0f36a2 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -641,7 +641,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
641 lock (m_openRequests) 641 lock (m_openRequests)
642 m_openRequests.Add(requestID, mrs); 642 m_openRequests.Add(requestID, mrs);
643 643
644 WebRequest mapitemsrequest = WebRequest.Create(httpserver); 644 WebRequest mapitemsrequest = null;
645 try
646 {
647 mapitemsrequest = WebRequest.Create(httpserver);
648 }
649 catch (Exception e)
650 {
651 m_log.DebugFormat("[WORLD MAP]: Access to {0} failed with {1}", httpserver, e);
652 return new OSDMap();
653 }
654
645 mapitemsrequest.Method = "POST"; 655 mapitemsrequest.Method = "POST";
646 mapitemsrequest.ContentType = "application/xml+llsd"; 656 mapitemsrequest.ContentType = "application/xml+llsd";
647 OSDMap RAMap = new OSDMap(); 657 OSDMap RAMap = new OSDMap();
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
index 585eb00..576b645 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
@@ -43,7 +43,21 @@ namespace OpenSim.Region.Framework.Interfaces
43 LandData LandData { get; set; } 43 LandData LandData { get; set; }
44 bool[,] LandBitmap { get; set; } 44 bool[,] LandBitmap { get; set; }
45 UUID RegionUUID { get; } 45 UUID RegionUUID { get; }
46
47 /// <summary>
48 /// The start point for the land object. This is the western-most point as one scans land working from
49 /// north to south.
50 /// </summary>
51 Vector3 StartPoint { get; }
52
53 /// <summary>
54 /// The end point for the land object. This is the eastern-most point as one scans land working from
55 /// south to north.
56 /// </summary>
57 Vector3 EndPoint { get; }
58
46 bool ContainsPoint(int x, int y); 59 bool ContainsPoint(int x, int y);
60
47 ILandObject Copy(); 61 ILandObject Copy();
48 62
49 void SendLandUpdateToAvatarsOverMe(); 63 void SendLandUpdateToAvatarsOverMe();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 12fd813..dc08b49 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -498,12 +498,6 @@ namespace OpenSim.Region.Framework.Scenes
498 get { return m_sceneGraph.Entities; } 498 get { return m_sceneGraph.Entities; }
499 } 499 }
500 500
501 public Dictionary<UUID, ScenePresence> m_restorePresences
502 {
503 get { return m_sceneGraph.RestorePresences; }
504 set { m_sceneGraph.RestorePresences = value; }
505 }
506
507 #endregion Properties 501 #endregion Properties
508 502
509 #region Constructors 503 #region Constructors
@@ -2483,56 +2477,26 @@ namespace OpenSim.Region.Framework.Scenes
2483 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 2477 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
2484 2478
2485 CheckHeartbeat(); 2479 CheckHeartbeat();
2486 ScenePresence presence;
2487 2480
2488 if (m_restorePresences.ContainsKey(client.AgentId)) 2481 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
2489 { 2482 {
2490 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); 2483 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2491 2484
2492 m_clientManager.Add(client); 2485 m_clientManager.Add(client);
2493 SubscribeToClientEvents(client); 2486 SubscribeToClientEvents(client);
2494 2487
2495 presence = m_restorePresences[client.AgentId]; 2488 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance);
2496 m_restorePresences.Remove(client.AgentId); 2489 m_eventManager.TriggerOnNewPresence(sp);
2497
2498 // This is one of two paths to create avatars that are
2499 // used. This tends to get called more in standalone
2500 // than grid, not really sure why, but as such needs
2501 // an explicity appearance lookup here.
2502 AvatarAppearance appearance = null;
2503 GetAvatarAppearance(client, out appearance);
2504 presence.Appearance = appearance;
2505 2490
2506 presence.initializeScenePresence(client, RegionInfo, this); 2491 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
2507 2492
2508 m_sceneGraph.AddScenePresence(presence); 2493 // HERE!!! Do the initial attachments right here
2509 2494 // first agent upon login is a root agent by design.
2510 lock (m_restorePresences) 2495 // All other AddNewClient calls find aCircuit.child to be true
2496 if (aCircuit.child == false)
2511 { 2497 {
2512 Monitor.PulseAll(m_restorePresences); 2498 sp.IsChildAgent = false;
2513 } 2499 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2514 }
2515 else
2516 {
2517 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
2518 {
2519 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2520
2521 m_clientManager.Add(client);
2522 SubscribeToClientEvents(client);
2523
2524 ScenePresence sp = CreateAndAddScenePresence(client);
2525 if (aCircuit != null)
2526 sp.Appearance = aCircuit.Appearance;
2527
2528 // HERE!!! Do the initial attachments right here
2529 // first agent upon login is a root agent by design.
2530 // All other AddNewClient calls find aCircuit.child to be true
2531 if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
2532 {
2533 sp.IsChildAgent = false;
2534 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2535 }
2536 } 2500 }
2537 } 2501 }
2538 2502
@@ -2997,25 +2961,6 @@ namespace OpenSim.Region.Framework.Scenes
2997 } 2961 }
2998 2962
2999 /// <summary> 2963 /// <summary>
3000 /// Create a child agent scene presence and add it to this scene.
3001 /// </summary>
3002 /// <param name="client"></param>
3003 /// <returns></returns>
3004 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
3005 {
3006 CheckHeartbeat();
3007 AvatarAppearance appearance = null;
3008 GetAvatarAppearance(client, out appearance);
3009
3010 ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
3011 //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
3012
3013 m_eventManager.TriggerOnNewPresence(avatar);
3014
3015 return avatar;
3016 }
3017
3018 /// <summary>
3019 /// Get the avatar apperance for the given client. 2964 /// Get the avatar apperance for the given client.
3020 /// </summary> 2965 /// </summary>
3021 /// <param name="client"></param> 2966 /// <param name="client"></param>
@@ -3324,6 +3269,10 @@ namespace OpenSim.Region.Framework.Scenes
3324 } 3269 }
3325 else 3270 else
3326 { 3271 {
3272 // Let the SP know how we got here. This has a lot of interesting
3273 // uses down the line.
3274 sp.TeleportFlags = (TeleportFlags)teleportFlags;
3275
3327 if (sp.IsChildAgent) 3276 if (sp.IsChildAgent)
3328 { 3277 {
3329 m_log.DebugFormat( 3278 m_log.DebugFormat(
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a2ed54f..969ff13 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -73,7 +73,6 @@ namespace OpenSim.Region.Framework.Scenes
73 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); 73 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
74 74
75 protected internal EntityManager Entities = new EntityManager(); 75 protected internal EntityManager Entities = new EntityManager();
76 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
77 76
78 protected RegionInfo m_regInfo; 77 protected RegionInfo m_regInfo;
79 protected Scene m_parentScene; 78 protected Scene m_parentScene;
@@ -564,8 +563,8 @@ namespace OpenSim.Region.Framework.Scenes
564 { 563 {
565 ScenePresence newAvatar = null; 564 ScenePresence newAvatar = null;
566 565
566 // ScenePresence always defaults to child agent
567 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 567 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
568 newAvatar.IsChildAgent = true;
569 568
570 AddScenePresence(newAvatar); 569 AddScenePresence(newAvatar);
571 570
@@ -578,6 +577,7 @@ namespace OpenSim.Region.Framework.Scenes
578 /// <param name="presence"></param> 577 /// <param name="presence"></param>
579 protected internal void AddScenePresence(ScenePresence presence) 578 protected internal void AddScenePresence(ScenePresence presence)
580 { 579 {
580 // Always a child when added to the scene
581 bool child = presence.IsChildAgent; 581 bool child = presence.IsChildAgent;
582 582
583 if (child) 583 if (child)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 91bb3a5..67e59c6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -178,6 +178,8 @@ namespace OpenSim.Region.Framework.Scenes
178 { 178 {
179 item.LastOwnerID = item.OwnerID; 179 item.LastOwnerID = item.OwnerID;
180 item.OwnerID = ownerId; 180 item.OwnerID = ownerId;
181 item.PermsMask = 0;
182 item.PermsGranter = UUID.Zero;
181 } 183 }
182 } 184 }
183 } 185 }
@@ -695,7 +697,6 @@ namespace OpenSim.Region.Framework.Scenes
695 { 697 {
696 item.ParentID = m_part.UUID; 698 item.ParentID = m_part.UUID;
697 item.ParentPartID = m_part.UUID; 699 item.ParentPartID = m_part.UUID;
698 item.Flags = m_items[item.ItemID].Flags;
699 700
700 // If group permissions have been set on, check that the groupID is up to date in case it has 701 // If group permissions have been set on, check that the groupID is up to date in case it has
701 // changed since permissions were last set. 702 // changed since permissions were last set.
@@ -850,7 +851,7 @@ namespace OpenSim.Region.Framework.Scenes
850 /// <param name="xferManager"></param> 851 /// <param name="xferManager"></param>
851 public void RequestInventoryFile(IClientAPI client, IXfer xferManager) 852 public void RequestInventoryFile(IClientAPI client, IXfer xferManager)
852 { 853 {
853 bool changed = CreateInventoryFile(); 854 CreateInventoryFile();
854 855
855 if (m_inventorySerial == 0) // No inventory 856 if (m_inventorySerial == 0) // No inventory
856 { 857 {
@@ -1013,6 +1014,8 @@ namespace OpenSim.Region.Framework.Scenes
1013 item.BasePermissions &= item.NextPermissions; 1014 item.BasePermissions &= item.NextPermissions;
1014 item.EveryonePermissions &= item.NextPermissions; 1015 item.EveryonePermissions &= item.NextPermissions;
1015 item.OwnerChanged = true; 1016 item.OwnerChanged = true;
1017 item.PermsMask = 0;
1018 item.PermsGranter = UUID.Zero;
1016 } 1019 }
1017 } 1020 }
1018 } 1021 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3a40196..1c276fa 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -130,6 +130,13 @@ namespace OpenSim.Region.Framework.Scenes
130 private bool m_updateflag; 130 private bool m_updateflag;
131 private byte m_movementflag; 131 private byte m_movementflag;
132 private Vector3? m_forceToApply; 132 private Vector3? m_forceToApply;
133 private TeleportFlags m_teleportFlags;
134 public TeleportFlags TeleportFlags
135 {
136 get { return m_teleportFlags; }
137 set { m_teleportFlags = value; }
138 }
139
133 private uint m_requestedSitTargetID; 140 private uint m_requestedSitTargetID;
134 private UUID m_requestedSitTargetUUID; 141 private UUID m_requestedSitTargetUUID;
135 public bool SitGround = false; 142 public bool SitGround = false;
@@ -928,10 +935,6 @@ namespace OpenSim.Region.Framework.Scenes
928 //else 935 //else
929 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); 936 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
930 937
931 // On the next prim update, all objects will be sent
932 //
933 m_sceneViewer.Reset();
934
935 m_isChildAgent = false; 938 m_isChildAgent = false;
936 939
937 // send the animations of the other presences to me 940 // send the animations of the other presences to me
@@ -953,6 +956,10 @@ namespace OpenSim.Region.Framework.Scenes
953 /// </summary> 956 /// </summary>
954 public void MakeChildAgent() 957 public void MakeChildAgent()
955 { 958 {
959 // Reset these so that teleporting in and walking out isn't seen
960 // as teleporting back
961 m_teleportFlags = TeleportFlags.Default;
962
956 // It looks like m_animator is set to null somewhere, and MakeChild 963 // It looks like m_animator is set to null somewhere, and MakeChild
957 // is called after that. Probably in aborted teleports. 964 // is called after that. Probably in aborted teleports.
958 if (m_animator == null) 965 if (m_animator == null)
@@ -1108,7 +1115,7 @@ namespace OpenSim.Region.Framework.Scenes
1108 /// </summary> 1115 /// </summary>
1109 public void CompleteMovement(IClientAPI client) 1116 public void CompleteMovement(IClientAPI client)
1110 { 1117 {
1111 DateTime startTime = DateTime.Now; 1118// DateTime startTime = DateTime.Now;
1112 1119
1113 m_log.DebugFormat( 1120 m_log.DebugFormat(
1114 "[SCENE PRESENCE]: Completing movement of {0} into region {1}", 1121 "[SCENE PRESENCE]: Completing movement of {0} into region {1}",
@@ -1161,9 +1168,9 @@ namespace OpenSim.Region.Framework.Scenes
1161 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1168 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1162 } 1169 }
1163 1170
1164 m_log.DebugFormat( 1171// m_log.DebugFormat(
1165 "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1172// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1166 client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1173// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1167 } 1174 }
1168 1175
1169 /// <summary> 1176 /// <summary>
@@ -2952,10 +2959,6 @@ namespace OpenSim.Region.Framework.Scenes
2952 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 2959 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
2953 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 2960 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
2954 2961
2955 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
2956 if (m_scene.m_seeIntoRegionFromNeighbor)
2957 m_sceneViewer.Reset();
2958
2959 //cAgentData.AVHeight; 2962 //cAgentData.AVHeight;
2960 m_rootRegionHandle = cAgentData.RegionHandle; 2963 m_rootRegionHandle = cAgentData.RegionHandle;
2961 //m_velocity = cAgentData.Velocity; 2964 //m_velocity = cAgentData.Velocity;
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
new file mode 100644
index 0000000..87d067c
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -0,0 +1,348 @@
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.Reflection;
31using System.Text;
32using log4net;
33using Mono.Addins;
34using Nini.Config;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Framework.Console;
38using OpenSim.Framework.Statistics;
39using OpenSim.Region.ClientStack.LindenUDP;
40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes;
42
43namespace OpenSim.Region.CoreModules.UDP.Linden
44{
45 /// <summary>
46 /// A module that just holds commands for inspecting the current state of the Linden UDP stack.
47 /// </summary>
48 /// <remarks>
49 /// All actual client stack functionality remains in OpenSim.Region.ClientStack.LindenUDP
50 /// </remarks>
51 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")]
52 public class LindenUDPInfoModule : ISharedRegionModule
53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55
56 protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
57
58 public string Name { get { return "Linden UDP Module"; } }
59
60 public Type ReplaceableInterface { get { return null; } }
61
62 public void Initialise(IConfigSource source)
63 {
64// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: INITIALIZED MODULE");
65 }
66
67 public void PostInitialise()
68 {
69// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: POST INITIALIZED MODULE");
70 }
71
72 public void Close()
73 {
74// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: CLOSED MODULE");
75 }
76
77 public void AddRegion(Scene scene)
78 {
79// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
80
81 lock (m_scenes)
82 m_scenes[scene.RegionInfo.RegionID] = scene;
83
84 scene.AddCommand(
85 this, "show queues",
86 "show queues [full]",
87 "Show queue data for each client",
88 "Without the 'full' option, only root agents are shown."
89 + " With the 'full' option child agents are also shown.",
90 ShowQueuesReport);
91
92 scene.AddCommand(
93 this, "show throttles",
94 "show throttles [full]",
95 "Show throttle settings for each client and for the server overall",
96 "Without the 'full' option, only root agents are shown."
97 + " With the 'full' option child agents are also shown.",
98 ShowThrottlesReport);
99 }
100
101 public void RemoveRegion(Scene scene)
102 {
103// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
104
105 lock (m_scenes)
106 m_scenes.Remove(scene.RegionInfo.RegionID);
107 }
108
109 public void RegionLoaded(Scene scene)
110 {
111// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
112 }
113
114 protected void ShowQueuesReport(string module, string[] cmd)
115 {
116 MainConsole.Instance.Output(GetQueuesReport(cmd));
117 }
118
119 protected void ShowThrottlesReport(string module, string[] cmd)
120 {
121 MainConsole.Instance.Output(GetThrottlesReport(cmd));
122 }
123
124 protected string GetColumnEntry(string entry, int maxLength, int columnPadding)
125 {
126 return string.Format(
127 "{0,-" + maxLength + "}{1,-" + columnPadding + "}",
128 entry.Length > maxLength ? entry.Substring(0, maxLength) : entry,
129 "");
130 }
131
132 /// <summary>
133 /// Generate UDP Queue data report for each client
134 /// </summary>
135 /// <param name="showParams"></param>
136 /// <returns></returns>
137 protected string GetQueuesReport(string[] showParams)
138 {
139 bool showChildren = false;
140
141 if (showParams.Length > 2 && showParams[2] == "full")
142 showChildren = true;
143
144 StringBuilder report = new StringBuilder();
145
146 int columnPadding = 2;
147 int maxNameLength = 18;
148 int maxRegionNameLength = 14;
149 int maxTypeLength = 4;
150 int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
151
152 report.Append(GetColumnEntry("User", maxNameLength, columnPadding));
153 report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding));
154 report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
155
156 report.AppendFormat(
157 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
158 "Pkts",
159 "Pkts",
160 "Bytes",
161 "Pkts",
162 "Pkts",
163 "Pkts",
164 "Pkts",
165 "Pkts",
166 "Pkts",
167 "Pkts",
168 "Pkts");
169
170 report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
171 report.AppendFormat(
172 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
173 "Out",
174 "In",
175 "Unacked",
176 "Resend",
177 "Land",
178 "Wind",
179 "Cloud",
180 "Task",
181 "Texture",
182 "Asset",
183 "State");
184
185 lock (m_scenes)
186 {
187 foreach (Scene scene in m_scenes.Values)
188 {
189 scene.ForEachClient(
190 delegate(IClientAPI client)
191 {
192 if (client is IStatsCollector)
193 {
194 bool isChild = scene.PresenceChildStatus(client.AgentId);
195 if (isChild && !showChildren)
196 return;
197
198 string name = client.Name;
199 string regionName = scene.RegionInfo.RegionName;
200
201 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
202 report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding));
203 report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
204
205 IStatsCollector stats = (IStatsCollector)client;
206
207 report.AppendLine(stats.Report());
208 }
209 });
210 }
211 }
212
213 return report.ToString();
214 }
215
216 /// <summary>
217 /// Show throttle data
218 /// </summary>
219 /// <param name="showParams"></param>
220 /// <returns></returns>
221 protected string GetThrottlesReport(string[] showParams)
222 {
223 bool showChildren = false;
224
225 if (showParams.Length > 2 && showParams[2] == "full")
226 showChildren = true;
227
228 StringBuilder report = new StringBuilder();
229
230 int columnPadding = 2;
231 int maxNameLength = 18;
232 int maxRegionNameLength = 14;
233 int maxTypeLength = 4;
234 int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
235
236 report.Append(GetColumnEntry("User", maxNameLength, columnPadding));
237 report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding));
238 report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
239
240 report.AppendFormat(
241 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n",
242 "Total",
243 "Resend",
244 "Land",
245 "Wind",
246 "Cloud",
247 "Task",
248 "Texture",
249 "Asset");
250
251 report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
252 report.AppendFormat(
253 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
254 "kb/s",
255 "kb/s",
256 "kb/s",
257 "kb/s",
258 "kb/s",
259 "kb/s",
260 "kb/s",
261 "kb/s");
262
263 report.AppendLine();
264
265 bool firstClient = true;
266
267 lock (m_scenes)
268 {
269 foreach (Scene scene in m_scenes.Values)
270 {
271 scene.ForEachClient(
272 delegate(IClientAPI client)
273 {
274 if (client is LLClientView)
275 {
276 LLClientView llClient = client as LLClientView;
277
278 if (firstClient)
279 {
280 report.AppendLine(GetServerThrottlesReport(llClient.UDPServer));
281 firstClient = false;
282 }
283
284 bool isChild = scene.PresenceChildStatus(client.AgentId);
285 if (isChild && !showChildren)
286 return;
287
288 string name = client.Name;
289 string regionName = scene.RegionInfo.RegionName;
290
291 LLUDPClient llUdpClient = llClient.UDPClient;
292 ClientInfo ci = llUdpClient.GetClientInfo();
293
294 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
295 report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding));
296 report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
297
298 report.AppendFormat(
299 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
300 (ci.totalThrottle * 8) / 1000,
301 (ci.resendThrottle * 8) / 1000,
302 (ci.landThrottle * 8) / 1000,
303 (ci.windThrottle * 8) / 1000,
304 (ci.cloudThrottle * 8) / 1000,
305 (ci.taskThrottle * 8) / 1000,
306 (ci.textureThrottle * 8) / 1000,
307 (ci.assetThrottle * 8) / 1000);
308
309 report.AppendLine();
310 }
311 });
312 }
313 }
314
315 return report.ToString();
316 }
317
318 protected string GetServerThrottlesReport(LLUDPServer udpServer)
319 {
320 StringBuilder report = new StringBuilder();
321
322 int columnPadding = 2;
323 int maxNameLength = 18;
324 int maxRegionNameLength = 14;
325 int maxTypeLength = 4;
326
327 string name = "SERVER AGENT LIMITS";
328
329 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
330 report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding));
331 report.Append(GetColumnEntry("-", maxTypeLength, columnPadding));
332
333 ThrottleRates throttleRates = udpServer.ThrottleRates;
334 report.AppendFormat(
335 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
336 "n/a",
337 (throttleRates.ResendLimit * 8) / 1000,
338 (throttleRates.LandLimit * 8) / 1000,
339 (throttleRates.WindLimit * 8) / 1000,
340 (throttleRates.CloudLimit * 8) / 1000,
341 (throttleRates.TaskLimit * 8) / 1000,
342 (throttleRates.TextureLimit * 8) / 1000,
343 (throttleRates.AssetLimit * 8) / 1000);
344
345 return report.ToString();
346 }
347 }
348} \ No newline at end of file