diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index a1bdfb94e2..adf653ac4c 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -250,6 +250,8 @@ namespace OpenSim + "If level <= 0 then no extra http logging is done.\n", Debug); + m_console.Commands.AddCommand("region", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); + m_console.Commands.AddCommand("region", false, "debug scene", "debug scene ", "Turn on scene debugging", Debug); @@ -948,6 +950,21 @@ namespace OpenSim break; + case "teleport": + foreach(Scene s in m_sceneManager.Scenes) + { + if (s.DEBUG) + { + s.DEBUG = false; + MainConsole.Instance.Output("Teleport debugging is disabled!"); + } + else{ + s.DEBUG = true; + MainConsole.Instance.Output("Teleport debugging is enabled!"); + } + } + break; + default: MainConsole.Instance.Output("Unknown debug command"); break; diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index a77646c2e9..9c53fc4ac8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -496,13 +496,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends string agentFriendService = string.Empty; string friendFriendService = string.Empty; - if (agentIsLocal) + if (agentClient != null) { agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); } - if (friendIsLocal) + if (friendClient != null) { friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4de494fac6..fc1e85a5fb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,6 +65,7 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; + public bool DEBUG = false; public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; @@ -2652,7 +2653,7 @@ namespace OpenSim.Region.Framework.Scenes sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); m_eventManager.TriggerOnNewPresence(sp); - sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; + sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; // The first agent upon login is a root agent by design. // For this agent we will have to rez the attachments. @@ -3478,7 +3479,7 @@ namespace OpenSim.Region.Framework.Scenes { // Let the SP know how we got here. This has a lot of interesting // uses down the line. - sp.TeleportFlags = (TeleportFlags)teleportFlags; + sp.TeleportFlags = (TPFlags)teleportFlags; if (sp.IsChildAgent) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 635bca7492..9f9536aa34 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -40,6 +40,7 @@ using OpenSim.Region.Framework.Scenes.Types; using OpenSim.Region.Physics.Manager; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Services.Interfaces; +using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags; namespace OpenSim.Region.Framework.Scenes { @@ -3845,27 +3846,13 @@ namespace OpenSim.Region.Framework.Scenes private void CheckAndAdjustLandingPoint(ref Vector3 pos) { -// // Some temporary debugging help to show all the TeleportFlags we have... -// bool HG = false; -// if((m_teleportFlags & (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) == (TeleportFlags)Constants.TeleportFlags.ViaHGLogin) -// HG = true; -// -// m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); -// -// for (uint i = 0; i <= 30 ; i++) -// { -// if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i) -// if (HG == false) -// m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString()); -// else -// m_log.InfoFormat("[SCENE PRESENCE]: HG Teleport Flags include {0}", ((TeleportFlags)i).ToString()); -// } -// -// m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) { + if (Scene.DEBUG) + TeleportFlagsDebug(); + // If we come in via login, landmark or map, we want to // honor landing points. If we come in via Lure, we want // to ignore them. @@ -4054,5 +4041,30 @@ namespace OpenSim.Region.Framework.Scenes } }); } + + private void TeleportFlagsDebug() { + + // Some temporary debugging help to show all the TeleportFlags we have... + bool HG = false; + if((m_teleportFlags & TeleportFlags.ViaHGLogin) == TeleportFlags.ViaHGLogin) + HG = true; + + m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); + + uint i = 0u; + for (int x = 0; x <= 30 ; x++, i = 1u << x) + { + i = 1u << x; + + if((m_teleportFlags & (TeleportFlags)i) == (TeleportFlags)i) + if (HG == false) + m_log.InfoFormat("[SCENE PRESENCE]: Teleport Flags include {0}", ((TeleportFlags) i).ToString()); + else + m_log.InfoFormat("[SCENE PRESENCE]: HG Teleport Flags include {0}", ((TeleportFlags)i).ToString()); + } + + m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); + + } } } diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 39cd4c992c..2369d94aa1 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Reflection; using System.Text; using log4net; @@ -124,6 +125,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance + "\nIf the viewer has not yet sent the server any texture ids then nothing will happen" + "\nsince requests can only be made for ids that the client has already sent us", HandleRebakeAppearanceCommand); + + scene.AddCommand( + this, "appearance find", + "appearance find ", + "Find out which avatar uses the given asset as a baked texture, if any.", + "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.", + HandleFindAppearanceCommand); } private void HandleSendAppearanceCommand(string module, string[] cmd) @@ -254,5 +262,47 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance } } } + + protected void HandleFindAppearanceCommand(string module, string[] cmd) + { + if (cmd.Length != 3) + { + MainConsole.Instance.OutputFormat("Usage: appearance find "); + return; + } + + string rawUuid = cmd[2]; + + HashSet matchedAvatars = new HashSet(); + + lock (m_scenes) + { + foreach (Scene scene in m_scenes.Values) + { + scene.ForEachRootScenePresence( + sp => + { + Dictionary bakedFaces = scene.AvatarFactory.GetBakedTextureFaces(sp.UUID); + foreach (Primitive.TextureEntryFace face in bakedFaces.Values) + { + if (face != null && face.TextureID.ToString().StartsWith(rawUuid)) + matchedAvatars.Add(sp); + } + }); + } + } + + if (matchedAvatars.Count == 0) + { + MainConsole.Instance.OutputFormat("{0} did not match any baked avatar textures in use", rawUuid); + } + else + { + MainConsole.Instance.OutputFormat( + "{0} matched {1}", + rawUuid, + string.Join(", ", matchedAvatars.ToList().ConvertAll(sp => sp.Name).ToArray())); + } + } } } \ No newline at end of file diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index d4e61a559b..01c64c5b3b 100755 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -36,6 +36,12 @@ [Startup] + + ;# {DEBUG} {} {Turn on debugging methods. Temporary for debugging teleport routing. We can remove it when that is done, or leave it if it would prove to be useful for other things.} {true false} false + ;; Turn on debugging methods where available. + ;; from the selected region_info_source. + ; DEBUG = false + ;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) " ;; Console prompt ;; Certain special characters can be used to customize the prompt