diff options
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/EventQueue')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 96 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs | 2 |
2 files changed, 37 insertions, 61 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index e113c60..986a665 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -55,8 +55,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
55 | public OSDMap body; | 55 | public OSDMap body; |
56 | } | 56 | } |
57 | 57 | ||
58 | //[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 58 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EventQueueGetModule")] |
59 | public class EventQueueGetModule : IEventQueue, IRegionModule | 59 | public class EventQueueGetModule : IEventQueue, INonSharedRegionModule |
60 | { | 60 | { |
61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
62 | 62 | ||
@@ -66,8 +66,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
66 | public int DebugLevel { get; set; } | 66 | public int DebugLevel { get; set; } |
67 | 67 | ||
68 | protected Scene m_scene; | 68 | protected Scene m_scene; |
69 | private IConfigSource m_gConfig; | ||
70 | bool enabledYN; | ||
71 | 69 | ||
72 | private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); | 70 | private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); |
73 | 71 | ||
@@ -75,59 +73,46 @@ namespace OpenSim.Region.ClientStack.Linden | |||
75 | private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>(); | 73 | private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>(); |
76 | private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>(); | 74 | private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>(); |
77 | 75 | ||
78 | #region IRegionModule methods | 76 | #region INonSharedRegionModule methods |
79 | public virtual void Initialise(Scene scene, IConfigSource config) | 77 | public virtual void Initialise(IConfigSource config) |
80 | { | 78 | { |
81 | m_gConfig = config; | 79 | } |
82 | 80 | ||
83 | IConfig startupConfig = m_gConfig.Configs["Startup"]; | 81 | public void AddRegion(Scene scene) |
82 | { | ||
83 | m_scene = scene; | ||
84 | scene.RegisterModuleInterface<IEventQueue>(this); | ||
84 | 85 | ||
85 | ReadConfigAndPopulate(scene, startupConfig, "Startup"); | 86 | scene.EventManager.OnClientClosed += ClientClosed; |
87 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | ||
88 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
86 | 89 | ||
87 | if (enabledYN) | 90 | MainConsole.Instance.Commands.AddCommand( |
88 | { | 91 | "Debug", |
89 | m_scene = scene; | 92 | false, |
90 | scene.RegisterModuleInterface<IEventQueue>(this); | 93 | "debug eq", |
91 | 94 | "debug eq [0|1|2]", | |
92 | // Register fallback handler | 95 | "Turn on event queue debugging\n" |
93 | // Why does EQG Fail on region crossings! | 96 | + " <= 0 - turns off all event queue logging\n" |
94 | 97 | + " >= 1 - turns on outgoing event logging\n" | |
95 | //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); | 98 | + " >= 2 - turns on poll notification", |
96 | 99 | HandleDebugEq); | |
97 | scene.EventManager.OnNewClient += OnNewClient; | ||
98 | |||
99 | // TODO: Leaving these open, or closing them when we | ||
100 | // become a child is incorrect. It messes up TP in a big | ||
101 | // way. CAPS/EQ need to be active as long as the UDP | ||
102 | // circuit is there. | ||
103 | |||
104 | scene.EventManager.OnClientClosed += ClientClosed; | ||
105 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | ||
106 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
107 | |||
108 | MainConsole.Instance.Commands.AddCommand( | ||
109 | "Debug", | ||
110 | false, | ||
111 | "debug eq", | ||
112 | "debug eq [0|1|2]", | ||
113 | "Turn on event queue debugging" | ||
114 | + "<= 0 - turns off all event queue logging" | ||
115 | + ">= 1 - turns on outgoing event logging" | ||
116 | + ">= 2 - turns on poll notification", | ||
117 | HandleDebugEq); | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | m_gConfig = null; | ||
122 | } | ||
123 | } | 100 | } |
124 | 101 | ||
125 | private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) | 102 | public void RemoveRegion(Scene scene) |
126 | { | 103 | { |
127 | enabledYN = startupConfig.GetBoolean("EventQueue", true); | 104 | if (m_scene != scene) |
105 | return; | ||
106 | |||
107 | scene.EventManager.OnClientClosed -= ClientClosed; | ||
108 | scene.EventManager.OnMakeChildAgent -= MakeChildAgent; | ||
109 | scene.EventManager.OnRegisterCaps -= OnRegisterCaps; | ||
110 | |||
111 | scene.UnregisterModuleInterface<IEventQueue>(this); | ||
112 | m_scene = null; | ||
128 | } | 113 | } |
129 | 114 | ||
130 | public void PostInitialise() | 115 | public void RegionLoaded(Scene scene) |
131 | { | 116 | { |
132 | } | 117 | } |
133 | 118 | ||
@@ -140,10 +125,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
140 | get { return "EventQueueGetModule"; } | 125 | get { return "EventQueueGetModule"; } |
141 | } | 126 | } |
142 | 127 | ||
143 | public bool IsSharedModule | 128 | public Type ReplaceableInterface |
144 | { | 129 | { |
145 | get { return false; } | 130 | get { return null; } |
146 | } | 131 | } |
132 | |||
147 | #endregion | 133 | #endregion |
148 | 134 | ||
149 | protected void HandleDebugEq(string module, string[] args) | 135 | protected void HandleDebugEq(string module, string[] args) |
@@ -226,16 +212,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
226 | 212 | ||
227 | #endregion | 213 | #endregion |
228 | 214 | ||
229 | private void OnNewClient(IClientAPI client) | ||
230 | { | ||
231 | //client.OnLogout += ClientClosed; | ||
232 | } | ||
233 | |||
234 | // private void ClientClosed(IClientAPI client) | ||
235 | // { | ||
236 | // ClientClosed(client.AgentId); | ||
237 | // } | ||
238 | |||
239 | private void ClientClosed(UUID agentID, Scene scene) | 215 | private void ClientClosed(UUID agentID, Scene scene) |
240 | { | 216 | { |
241 | // m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); | 217 | // m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index cd70410..d604cf6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs | |||
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests | |||
94 | UUID spId = TestHelpers.ParseTail(0x1); | 94 | UUID spId = TestHelpers.ParseTail(0x1); |
95 | 95 | ||
96 | SceneHelpers.AddScenePresence(m_scene, spId); | 96 | SceneHelpers.AddScenePresence(m_scene, spId); |
97 | m_scene.IncomingCloseAgent(spId); | 97 | m_scene.IncomingCloseAgent(spId, false); |
98 | 98 | ||
99 | // TODO: Add more assertions for the other aspects of event queues | 99 | // TODO: Add more assertions for the other aspects of event queues |
100 | Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0)); | 100 | Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0)); |