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 97b79ce..1d304db 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;
@@ -278,16 +279,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
278 279
279 public void Start() 280 public void Start()
280 { 281 {
281 if (m_scene == null) 282 StartInbound();
282 throw new InvalidOperationException("[LLUDPSERVER]: Cannot LLUDPServer.Start() without an IScene reference"); 283 StartOutbound();
283 284
285 m_elapsedMSSinceLastStatReport = Environment.TickCount;
286 }
287
288 private void StartInbound()
289 {
284 m_log.InfoFormat( 290 m_log.InfoFormat(
285 "[LLUDPSERVER]: Starting the LLUDP server in {0} mode", 291 "[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server in {0} mode",
286 m_asyncPacketHandling ? "asynchronous" : "synchronous"); 292 m_asyncPacketHandling ? "asynchronous" : "synchronous");
287 293
288 base.Start(m_recvBufferSize, m_asyncPacketHandling); 294 base.StartInbound(m_recvBufferSize, m_asyncPacketHandling);
289 295
290 // Start the packet processing threads 296 // This thread will process the packets received that are placed on the packetInbox
291 Watchdog.StartThread( 297 Watchdog.StartThread(
292 IncomingPacketHandler, 298 IncomingPacketHandler,
293 string.Format("Incoming Packets ({0})", m_scene.RegionInfo.RegionName), 299 string.Format("Incoming Packets ({0})", m_scene.RegionInfo.RegionName),
@@ -296,7 +302,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
296 true, 302 true,
297 GetWatchdogIncomingAlarmData, 303 GetWatchdogIncomingAlarmData,
298 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); 304 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS);
305 }
299 306
307 private void StartOutbound()
308 {
309 m_log.Info("[LLUDPSERVER]: Starting outbound packet processing for the LLUDP server");
310
311 base.StartOutbound();
312
313 // This thread will process the packets received that are placed on the packetInbox
300 Watchdog.StartThread( 314 Watchdog.StartThread(
301 OutgoingPacketHandler, 315 OutgoingPacketHandler,
302 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName), 316 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName),
@@ -305,8 +319,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
305 true, 319 true,
306 GetWatchdogOutgoingAlarmData, 320 GetWatchdogOutgoingAlarmData,
307 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); 321 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS);
322 }
308 323
309 m_elapsedMSSinceLastStatReport = Environment.TickCount; 324 public new void Stop()
325 {
326 m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName);
327 base.StopOutbound();
328 base.StopInbound();
310 } 329 }
311 330
312 /// <summary> 331 /// <summary>
@@ -331,12 +350,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
331 m_currentOutgoingClient != null ? m_currentOutgoingClient.Name : "none"); 350 m_currentOutgoingClient != null ? m_currentOutgoingClient.Name : "none");
332 } 351 }
333 352
334 public new void Stop()
335 {
336 m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName);
337 base.Stop();
338 }
339
340 public void AddScene(IScene scene) 353 public void AddScene(IScene scene)
341 { 354 {
342 if (m_scene != null) 355 if (m_scene != null)
@@ -353,6 +366,81 @@ namespace OpenSim.Region.ClientStack.LindenUDP
353 366
354 m_scene = (Scene)scene; 367 m_scene = (Scene)scene;
355 m_location = new Location(m_scene.RegionInfo.RegionHandle); 368 m_location = new Location(m_scene.RegionInfo.RegionHandle);
369
370 MainConsole.Instance.Commands.AddCommand(
371 "Debug",
372 false,
373 "debug lludp start",
374 "debug lludp start <in|out|all>",
375 "Control LLUDP packet processing.",
376 "No effect if packet processing has already started.\n"
377 + "in - start inbound processing.\n"
378 + "out - start outbound processing.\n"
379 + "all - start in and outbound processing.\n",
380 HandleStartCommand);
381
382 MainConsole.Instance.Commands.AddCommand(
383 "Debug",
384 false,
385 "debug lludp stop",
386 "debug lludp stop <in|out|all>",
387 "Stop LLUDP packet processing.",
388 "No effect if packet processing has already stopped.\n"
389 + "in - stop inbound processing.\n"
390 + "out - stop outbound processing.\n"
391 + "all - stop in and outbound processing.\n",
392 HandleStopCommand);
393
394 MainConsole.Instance.Commands.AddCommand(
395 "Debug",
396 false,
397 "debug lludp status",
398 "debug lludp status",
399 "Return status of LLUDP packet processing.",
400 HandleStatusCommand);
401 }
402
403 private void HandleStartCommand(string module, string[] args)
404 {
405 if (args.Length != 4)
406 {
407 MainConsole.Instance.Output("Usage: debug lludp start <in|out|all>");
408 return;
409 }
410
411 string subCommand = args[3];
412
413 if (subCommand == "in" || subCommand == "all")
414 StartInbound();
415
416 if (subCommand == "out" || subCommand == "all")
417 StartOutbound();
418 }
419
420 private void HandleStopCommand(string module, string[] args)
421 {
422 if (args.Length != 4)
423 {
424 MainConsole.Instance.Output("Usage: debug lludp stop <in|out|all>");
425 return;
426 }
427
428 string subCommand = args[3];
429
430 if (subCommand == "in" || subCommand == "all")
431 StopInbound();
432
433 if (subCommand == "out" || subCommand == "all")
434 StopOutbound();
435 }
436
437 private void HandleStatusCommand(string module, string[] args)
438 {
439 MainConsole.Instance.OutputFormat(
440 "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled");
441
442 MainConsole.Instance.OutputFormat(
443 "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled");
356 } 444 }
357 445
358 public bool HandlesRegion(Location x) 446 public bool HandlesRegion(Location x)
@@ -1239,7 +1327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1239 // on to en-US to avoid number parsing issues 1327 // on to en-US to avoid number parsing issues
1240 Culture.SetCurrentCulture(); 1328 Culture.SetCurrentCulture();
1241 1329
1242 while (base.IsRunning) 1330 while (base.IsRunningInbound)
1243 { 1331 {
1244 m_scene.ThreadAlive(1); 1332 m_scene.ThreadAlive(1);
1245 try 1333 try
@@ -1282,7 +1370,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1282 // Action generic every round 1370 // Action generic every round
1283 Action<IClientAPI> clientPacketHandler = ClientOutgoingPacketHandler; 1371 Action<IClientAPI> clientPacketHandler = ClientOutgoingPacketHandler;
1284 1372
1285 while (base.IsRunning) 1373 while (base.IsRunningOutbound)
1286 { 1374 {
1287 m_scene.ThreadAlive(2); 1375 m_scene.ThreadAlive(2);
1288 try 1376 try