aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs116
1 files changed, 102 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index e3f4679..fc6dd4d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -37,6 +37,7 @@ using log4net;
37using Nini.Config; 37using Nini.Config;
38using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Console;
40using OpenSim.Framework.Monitoring; 41using OpenSim.Framework.Monitoring;
41using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
42using OpenMetaverse; 43using OpenMetaverse;
@@ -274,16 +275,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
274 275
275 public void Start() 276 public void Start()
276 { 277 {
277 if (m_scene == null) 278 StartInbound();
278 throw new InvalidOperationException("[LLUDPSERVER]: Cannot LLUDPServer.Start() without an IScene reference"); 279 StartOutbound();
279 280
281 m_elapsedMSSinceLastStatReport = Environment.TickCount;
282 }
283
284 private void StartInbound()
285 {
280 m_log.InfoFormat( 286 m_log.InfoFormat(
281 "[LLUDPSERVER]: Starting the LLUDP server in {0} mode", 287 "[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server in {0} mode",
282 m_asyncPacketHandling ? "asynchronous" : "synchronous"); 288 m_asyncPacketHandling ? "asynchronous" : "synchronous");
283 289
284 base.Start(m_recvBufferSize, m_asyncPacketHandling); 290 base.StartInbound(m_recvBufferSize, m_asyncPacketHandling);
285 291
286 // Start the packet processing threads 292 // This thread will process the packets received that are placed on the packetInbox
287 Watchdog.StartThread( 293 Watchdog.StartThread(
288 IncomingPacketHandler, 294 IncomingPacketHandler,
289 string.Format("Incoming Packets ({0})", m_scene.RegionInfo.RegionName), 295 string.Format("Incoming Packets ({0})", m_scene.RegionInfo.RegionName),
@@ -292,7 +298,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
292 true, 298 true,
293 GetWatchdogIncomingAlarmData, 299 GetWatchdogIncomingAlarmData,
294 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); 300 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS);
301 }
295 302
303 private void StartOutbound()
304 {
305 m_log.Info("[LLUDPSERVER]: Starting outbound packet processing for the LLUDP server");
306
307 base.StartOutbound();
308
309 // This thread will process the packets received that are placed on the packetInbox
296 Watchdog.StartThread( 310 Watchdog.StartThread(
297 OutgoingPacketHandler, 311 OutgoingPacketHandler,
298 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName), 312 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName),
@@ -301,8 +315,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
301 true, 315 true,
302 GetWatchdogOutgoingAlarmData, 316 GetWatchdogOutgoingAlarmData,
303 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); 317 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS);
318 }
304 319
305 m_elapsedMSSinceLastStatReport = Environment.TickCount; 320 public new void Stop()
321 {
322 m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName);
323 base.StopOutbound();
324 base.StopInbound();
306 } 325 }
307 326
308 /// <summary> 327 /// <summary>
@@ -327,12 +346,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
327 m_currentOutgoingClient != null ? m_currentOutgoingClient.Name : "none"); 346 m_currentOutgoingClient != null ? m_currentOutgoingClient.Name : "none");
328 } 347 }
329 348
330 public new void Stop()
331 {
332 m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName);
333 base.Stop();
334 }
335
336 public void AddScene(IScene scene) 349 public void AddScene(IScene scene)
337 { 350 {
338 if (m_scene != null) 351 if (m_scene != null)
@@ -349,6 +362,81 @@ namespace OpenSim.Region.ClientStack.LindenUDP
349 362
350 m_scene = (Scene)scene; 363 m_scene = (Scene)scene;
351 m_location = new Location(m_scene.RegionInfo.RegionHandle); 364 m_location = new Location(m_scene.RegionInfo.RegionHandle);
365
366 MainConsole.Instance.Commands.AddCommand(
367 "Debug",
368 false,
369 "debug lludp start",
370 "debug lludp start <in|out|all>",
371 "Control LLUDP packet processing.",
372 "No effect if packet processing has already started.\n"
373 + "in - start inbound processing.\n"
374 + "out - start outbound processing.\n"
375 + "all - start in and outbound processing.\n",
376 HandleStartCommand);
377
378 MainConsole.Instance.Commands.AddCommand(
379 "Debug",
380 false,
381 "debug lludp stop",
382 "debug lludp stop <in|out|all>",
383 "Stop LLUDP packet processing.",
384 "No effect if packet processing has already stopped.\n"
385 + "in - stop inbound processing.\n"
386 + "out - stop outbound processing.\n"
387 + "all - stop in and outbound processing.\n",
388 HandleStopCommand);
389
390 MainConsole.Instance.Commands.AddCommand(
391 "Debug",
392 false,
393 "debug lludp status",
394 "debug lludp status",
395 "Return status of LLUDP packet processing.",
396 HandleStatusCommand);
397 }
398
399 private void HandleStartCommand(string module, string[] args)
400 {
401 if (args.Length != 4)
402 {
403 MainConsole.Instance.Output("Usage: debug lludp start <in|out|all>");
404 return;
405 }
406
407 string subCommand = args[3];
408
409 if (subCommand == "in" || subCommand == "all")
410 StartInbound();
411
412 if (subCommand == "out" || subCommand == "all")
413 StartOutbound();
414 }
415
416 private void HandleStopCommand(string module, string[] args)
417 {
418 if (args.Length != 4)
419 {
420 MainConsole.Instance.Output("Usage: debug lludp stop <in|out|all>");
421 return;
422 }
423
424 string subCommand = args[3];
425
426 if (subCommand == "in" || subCommand == "all")
427 StopInbound();
428
429 if (subCommand == "out" || subCommand == "all")
430 StopOutbound();
431 }
432
433 private void HandleStatusCommand(string module, string[] args)
434 {
435 MainConsole.Instance.OutputFormat(
436 "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled");
437
438 MainConsole.Instance.OutputFormat(
439 "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled");
352 } 440 }
353 441
354 public bool HandlesRegion(Location x) 442 public bool HandlesRegion(Location x)
@@ -1174,7 +1262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1174 // on to en-US to avoid number parsing issues 1262 // on to en-US to avoid number parsing issues
1175 Culture.SetCurrentCulture(); 1263 Culture.SetCurrentCulture();
1176 1264
1177 while (base.IsRunning) 1265 while (base.IsRunningInbound)
1178 { 1266 {
1179 try 1267 try
1180 { 1268 {
@@ -1216,7 +1304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1216 // Action generic every round 1304 // Action generic every round
1217 Action<IClientAPI> clientPacketHandler = ClientOutgoingPacketHandler; 1305 Action<IClientAPI> clientPacketHandler = ClientOutgoingPacketHandler;
1218 1306
1219 while (base.IsRunning) 1307 while (base.IsRunningOutbound)
1220 { 1308 {
1221 try 1309 try
1222 { 1310 {