aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
authorMelanie2013-07-04 22:32:58 +0100
committerMelanie2013-07-04 22:32:58 +0100
commit5ddcc25ee9de481c40a26aabc57d77c71225162e (patch)
tree298768abaca492365ac1c9786b0d4ce7dae934ab /OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
parentMerge branch 'master' into careminster (diff)
parentGuard against completely unknown user UUIDs. (diff)
downloadopensim-SC_OLD-5ddcc25ee9de481c40a26aabc57d77c71225162e.zip
opensim-SC_OLD-5ddcc25ee9de481c40a26aabc57d77c71225162e.tar.gz
opensim-SC_OLD-5ddcc25ee9de481c40a26aabc57d77c71225162e.tar.bz2
opensim-SC_OLD-5ddcc25ee9de481c40a26aabc57d77c71225162e.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs96
1 files changed, 95 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index d008702..7f14371 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -34,6 +34,7 @@ using System.Net.Sockets;
34using System.Reflection; 34using System.Reflection;
35using System.Threading; 35using System.Threading;
36using log4net; 36using log4net;
37using NDesk.Options;
37using Nini.Config; 38using Nini.Config;
38using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
39using OpenSim.Framework; 40using OpenSim.Framework;
@@ -102,10 +103,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
102 /// </summary> 103 /// </summary>
103 public class LLUDPServer : OpenSimUDPBase 104 public class LLUDPServer : OpenSimUDPBase
104 { 105 {
106 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
107
105 /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary> 108 /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary>
106 public const int MTU = 1400; 109 public const int MTU = 1400;
107 110
108 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 111 /// <summary>
112 /// Default packet debug level given to new clients
113 /// </summary>
114 public int DefaultClientPacketDebugLevel { get; set; }
109 115
110 /// <summary>The measured resolution of Environment.TickCount</summary> 116 /// <summary>The measured resolution of Environment.TickCount</summary>
111 public readonly float TickCountResolution; 117 public readonly float TickCountResolution;
@@ -516,6 +522,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
516 EnablePoolStats(); 522 EnablePoolStats();
517 523
518 MainConsole.Instance.Commands.AddCommand( 524 MainConsole.Instance.Commands.AddCommand(
525 "Debug", false, "debug lludp packet",
526 "debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]",
527 "Turn on packet debugging",
528 "If level > 255 then all incoming and outgoing packets are logged.\n"
529 + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
530 + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
531 + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
532 + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
533 + "If level <= 0 then no packets are logged.\n"
534 + "If --default is specified then the level becomes the default logging level for all subsequent agents.\n"
535 + "In this case, you cannot also specify an avatar name.\n"
536 + "If an avatar name is given then only packets from that avatar are logged.",
537 HandlePacketCommand);
538
539 MainConsole.Instance.Commands.AddCommand(
519 "Debug", 540 "Debug",
520 false, 541 false,
521 "debug lludp start", 542 "debug lludp start",
@@ -556,8 +577,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
556 HandleStatusCommand); 577 HandleStatusCommand);
557 } 578 }
558 579
580 private void HandlePacketCommand(string module, string[] args)
581 {
582 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
583 return;
584
585 bool setAsDefaultLevel = false;
586 OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null);
587 List<string> filteredArgs = optionSet.Parse(args);
588
589 string name = null;
590
591 if (filteredArgs.Count == 6)
592 {
593 if (!setAsDefaultLevel)
594 {
595 name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]);
596 }
597 else
598 {
599 MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level");
600 return;
601 }
602 }
603
604 if (filteredArgs.Count > 3)
605 {
606 int newDebug;
607 if (int.TryParse(filteredArgs[3], out newDebug))
608 {
609 if (setAsDefaultLevel)
610 {
611 DefaultClientPacketDebugLevel = newDebug;
612 MainConsole.Instance.OutputFormat(
613 "Debug packet debug for new clients set to {0}", DefaultClientPacketDebugLevel);
614 }
615 else
616 {
617 m_scene.ForEachScenePresence(sp =>
618 {
619 if (name == null || sp.Name == name)
620 {
621 MainConsole.Instance.OutputFormat(
622 "Packet debug for {0} ({1}) set to {2} in {3}",
623 sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name);
624
625 sp.ControllingClient.DebugPacketLevel = newDebug;
626 }
627 });
628 }
629 }
630 else
631 {
632 MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [<first-name> <last-name>]");
633 }
634 }
635 }
636
559 private void HandleStartCommand(string module, string[] args) 637 private void HandleStartCommand(string module, string[] args)
560 { 638 {
639 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
640 return;
641
561 if (args.Length != 4) 642 if (args.Length != 4)
562 { 643 {
563 MainConsole.Instance.Output("Usage: debug lludp start <in|out|all>"); 644 MainConsole.Instance.Output("Usage: debug lludp start <in|out|all>");
@@ -575,6 +656,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
575 656
576 private void HandleStopCommand(string module, string[] args) 657 private void HandleStopCommand(string module, string[] args)
577 { 658 {
659 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
660 return;
661
578 if (args.Length != 4) 662 if (args.Length != 4)
579 { 663 {
580 MainConsole.Instance.Output("Usage: debug lludp stop <in|out|all>"); 664 MainConsole.Instance.Output("Usage: debug lludp stop <in|out|all>");
@@ -592,6 +676,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
592 676
593 private void HandlePoolCommand(string module, string[] args) 677 private void HandlePoolCommand(string module, string[] args)
594 { 678 {
679 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
680 return;
681
595 if (args.Length != 4) 682 if (args.Length != 4)
596 { 683 {
597 MainConsole.Instance.Output("Usage: debug lludp pool <on|off>"); 684 MainConsole.Instance.Output("Usage: debug lludp pool <on|off>");
@@ -624,6 +711,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
624 711
625 private void HandleStatusCommand(string module, string[] args) 712 private void HandleStatusCommand(string module, string[] args)
626 { 713 {
714 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
715 return;
716
627 MainConsole.Instance.OutputFormat( 717 MainConsole.Instance.OutputFormat(
628 "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled"); 718 "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled");
629 719
@@ -631,6 +721,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
631 "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled"); 721 "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled");
632 722
633 MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off"); 723 MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off");
724
725 MainConsole.Instance.OutputFormat(
726 "Packet debug level for new clients is {0}", DefaultClientPacketDebugLevel);
634 } 727 }
635 728
636 public bool HandlesRegion(Location x) 729 public bool HandlesRegion(Location x)
@@ -1544,6 +1637,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1544 1637
1545 client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 1638 client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
1546 client.OnLogout += LogoutHandler; 1639 client.OnLogout += LogoutHandler;
1640 client.DebugPacketLevel = DefaultClientPacketDebugLevel;
1547 1641
1548 ((LLClientView)client).DisableFacelights = m_disableFacelights; 1642 ((LLClientView)client).DisableFacelights = m_disableFacelights;
1549 1643