diff options
author | Adam Frisby | 2008-05-03 19:33:59 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-03 19:33:59 +0000 |
commit | dcf004aa0de7d2158956f9095e1c90614b1417f0 (patch) | |
tree | 218d1f35b3bcfe992bebd47ff1c14cc31a6761c3 /ThirdParty/3Di/LoadBalancer | |
parent | * Refactor: move UpdateFolder into CachedUserInfo (diff) | |
download | opensim-SC-dcf004aa0de7d2158956f9095e1c90614b1417f0.zip opensim-SC-dcf004aa0de7d2158956f9095e1c90614b1417f0.tar.gz opensim-SC-dcf004aa0de7d2158956f9095e1c90614b1417f0.tar.bz2 opensim-SC-dcf004aa0de7d2158956f9095e1c90614b1417f0.tar.xz |
* Refactoring and major cleaning work done on 3Di's LoadBalancerPlugin - Johan, if you are still around, please shoot me a message.
Diffstat (limited to '')
-rw-r--r-- | ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs | 141 |
1 files changed, 64 insertions, 77 deletions
diff --git a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs index 9bccc0b..7025877 100644 --- a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs +++ b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs | |||
@@ -56,9 +56,9 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
56 | 56 | ||
57 | private BaseHttpServer commandServer; | 57 | private BaseHttpServer commandServer; |
58 | private bool[] isLocalNeighbour; | 58 | private bool[] isLocalNeighbour; |
59 | private bool isSplit = false; | 59 | private bool isSplit; |
60 | private TcpServer mTcpServer; | 60 | private TcpServer mTcpServer; |
61 | private object padlock = new object(); | 61 | private readonly object padlock = new object(); |
62 | 62 | ||
63 | private int proxyOffset; | 63 | private int proxyOffset; |
64 | private string proxyURL; | 64 | private string proxyURL; |
@@ -133,7 +133,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
133 | m_log.Info("[BALANCER] " + "Entering RegionStatus()"); | 133 | m_log.Info("[BALANCER] " + "Entering RegionStatus()"); |
134 | 134 | ||
135 | int src_port = (int) request.Params[0]; | 135 | int src_port = (int) request.Params[0]; |
136 | Scene scene = null; | 136 | Scene scene; |
137 | // try to get the scene object | 137 | // try to get the scene object |
138 | RegionInfo src_region = SearchRegionFromPortNum(src_port); | 138 | RegionInfo src_region = SearchRegionFromPortNum(src_port); |
139 | if (sceneManager.TryGetScene(src_region.RegionID, out scene) == false) | 139 | if (sceneManager.TryGetScene(src_region.RegionID, out scene) == false) |
@@ -181,7 +181,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
181 | } | 181 | } |
182 | catch (Exception e) | 182 | catch (Exception e) |
183 | { | 183 | { |
184 | m_log.Error("[BALANCER] " + e.ToString()); | 184 | m_log.Error("[BALANCER] " + e); |
185 | m_log.Error("[BALANCER] " + e.StackTrace); | 185 | m_log.Error("[BALANCER] " + e.StackTrace); |
186 | } | 186 | } |
187 | return response; | 187 | return response; |
@@ -202,7 +202,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
202 | } | 202 | } |
203 | catch (Exception e) | 203 | catch (Exception e) |
204 | { | 204 | { |
205 | m_log.Error("[BALANCER] " + e.ToString()); | 205 | m_log.Error("[BALANCER] " + e); |
206 | m_log.Error("[BALANCER] " + e.StackTrace); | 206 | m_log.Error("[BALANCER] " + e.StackTrace); |
207 | } | 207 | } |
208 | 208 | ||
@@ -226,7 +226,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
226 | } | 226 | } |
227 | catch (Exception e) | 227 | catch (Exception e) |
228 | { | 228 | { |
229 | m_log.Error("[BALANCER] " + e.ToString()); | 229 | m_log.Error("[BALANCER] " + e); |
230 | m_log.Error("[BALANCER] " + e.StackTrace); | 230 | m_log.Error("[BALANCER] " + e.StackTrace); |
231 | } | 231 | } |
232 | 232 | ||
@@ -250,9 +250,9 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
250 | } | 250 | } |
251 | catch (Exception e) | 251 | catch (Exception e) |
252 | { | 252 | { |
253 | m_log.Error("[BALANCER] " + e.ToString()); | 253 | m_log.Error("[BALANCER] " + e); |
254 | m_log.Error("[BALANCER] " + e.StackTrace); | 254 | m_log.Error("[BALANCER] " + e.StackTrace); |
255 | throw e; | 255 | throw; |
256 | } | 256 | } |
257 | 257 | ||
258 | return new XmlRpcResponse(); | 258 | return new XmlRpcResponse(); |
@@ -267,14 +267,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
267 | int src_port = (int) request.Params[0]; | 267 | int src_port = (int) request.Params[0]; |
268 | 268 | ||
269 | // backgroud | 269 | // backgroud |
270 | WaitCallback callback = new WaitCallback(TerminateRegion); | 270 | WaitCallback callback = TerminateRegion; |
271 | ThreadPool.QueueUserWorkItem(callback, src_port); | 271 | ThreadPool.QueueUserWorkItem(callback, src_port); |
272 | 272 | ||
273 | m_log.Info("[BALANCER] " + "Exiting TerminateRegion()"); | 273 | m_log.Info("[BALANCER] " + "Exiting TerminateRegion()"); |
274 | } | 274 | } |
275 | catch (Exception e) | 275 | catch (Exception e) |
276 | { | 276 | { |
277 | m_log.Error("[BALANCER] " + e.ToString()); | 277 | m_log.Error("[BALANCER] " + e); |
278 | m_log.Error("[BALANCER] " + e.StackTrace); | 278 | m_log.Error("[BALANCER] " + e.StackTrace); |
279 | } | 279 | } |
280 | 280 | ||
@@ -285,14 +285,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
285 | 285 | ||
286 | private void SerializeRegion(string src_url, int src_port) | 286 | private void SerializeRegion(string src_url, int src_port) |
287 | { | 287 | { |
288 | RegionInfo src_region = null; | ||
289 | |||
290 | //------------------------------------------ | 288 | //------------------------------------------ |
291 | // Processing of origin region | 289 | // Processing of origin region |
292 | //------------------------------------------ | 290 | //------------------------------------------ |
293 | 291 | ||
294 | // search origin region | 292 | // search origin region |
295 | src_region = SearchRegionFromPortNum(src_port); | 293 | RegionInfo src_region = SearchRegionFromPortNum(src_port); |
296 | 294 | ||
297 | if (src_region == null) | 295 | if (src_region == null) |
298 | { | 296 | { |
@@ -308,14 +306,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
308 | 306 | ||
309 | private void DeserializeRegion_Move(int src_port, int dst_port, string src_url, string dst_url) | 307 | private void DeserializeRegion_Move(int src_port, int dst_port, string src_url, string dst_url) |
310 | { | 308 | { |
311 | RegionInfo dst_region = null; | ||
312 | |||
313 | //------------------------------------------ | 309 | //------------------------------------------ |
314 | // Processing of destination region | 310 | // Processing of destination region |
315 | //------------------------------------------ | 311 | //------------------------------------------ |
316 | 312 | ||
317 | // import the source region's data | 313 | // import the source region's data |
318 | dst_region = DeserializeRegion(dst_port, true, serializeDir); | 314 | RegionInfo dst_region = DeserializeRegion(dst_port, serializeDir); |
319 | 315 | ||
320 | Util.XmlRpcCommand(dst_region.proxyUrl, "ChangeRegion", src_port + proxyOffset, src_url, dst_port + proxyOffset, dst_url); | 316 | Util.XmlRpcCommand(dst_region.proxyUrl, "ChangeRegion", src_port + proxyOffset, src_url, dst_port + proxyOffset, dst_url); |
321 | Util.XmlRpcCommand(dst_region.proxyUrl, "UnblockClientMessages", dst_url, dst_port + proxyOffset); | 317 | Util.XmlRpcCommand(dst_region.proxyUrl, "UnblockClientMessages", dst_url, dst_port + proxyOffset); |
@@ -323,14 +319,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
323 | 319 | ||
324 | private void DeserializeRegion_Clone(int src_port, int dst_port, string src_url, string dst_url) | 320 | private void DeserializeRegion_Clone(int src_port, int dst_port, string src_url, string dst_url) |
325 | { | 321 | { |
326 | RegionInfo dst_region = null; | ||
327 | |||
328 | //------------------------------------------ | 322 | //------------------------------------------ |
329 | // Processing of destination region | 323 | // Processing of destination region |
330 | //------------------------------------------ | 324 | //------------------------------------------ |
331 | 325 | ||
332 | // import the source region's data | 326 | // import the source region's data |
333 | dst_region = DeserializeRegion(dst_port, false, serializeDir); | 327 | RegionInfo dst_region = DeserializeRegion(dst_port, serializeDir); |
334 | 328 | ||
335 | // Decide who is in charge for each section | 329 | // Decide who is in charge for each section |
336 | int[] port = new int[] {src_port, dst_port}; | 330 | int[] port = new int[] {src_port, dst_port}; |
@@ -344,7 +338,6 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
344 | 338 | ||
345 | private void TerminateRegion(object param) | 339 | private void TerminateRegion(object param) |
346 | { | 340 | { |
347 | RegionInfo src_region = null; | ||
348 | int src_port = (int) param; | 341 | int src_port = (int) param; |
349 | 342 | ||
350 | //------------------------------------------ | 343 | //------------------------------------------ |
@@ -352,7 +345,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
352 | //------------------------------------------ | 345 | //------------------------------------------ |
353 | 346 | ||
354 | // search origin region | 347 | // search origin region |
355 | src_region = SearchRegionFromPortNum(src_port); | 348 | RegionInfo src_region = SearchRegionFromPortNum(src_port); |
356 | 349 | ||
357 | if (src_region == null) | 350 | if (src_region == null) |
358 | { | 351 | { |
@@ -391,14 +384,19 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
391 | 384 | ||
392 | private IClientNetworkServer SearchClientServerFromPortNum(int portnum) | 385 | private IClientNetworkServer SearchClientServerFromPortNum(int portnum) |
393 | { | 386 | { |
394 | return m_clientServers.Find(delegate(IClientNetworkServer server) { return (portnum + proxyOffset == ((IPEndPoint)server.Server.LocalEndPoint).Port); }); | 387 | return m_clientServers.Find( |
388 | delegate(IClientNetworkServer server) | ||
389 | { | ||
390 | // ReSharper disable PossibleNullReferenceException | ||
391 | return (portnum + proxyOffset == ((IPEndPoint) server.Server.LocalEndPoint).Port); | ||
392 | // ReSharper restore PossibleNullReferenceException | ||
393 | } | ||
394 | ); | ||
395 | } | 395 | } |
396 | 396 | ||
397 | private void SerializeRegion(RegionInfo src_region, string export_dir) | 397 | private void SerializeRegion(RegionInfo src_region, string export_dir) |
398 | { | 398 | { |
399 | Scene scene = null; | 399 | Scene scene; |
400 | List<ScenePresence> presences; | ||
401 | string filename; | ||
402 | int i = 0; | 400 | int i = 0; |
403 | 401 | ||
404 | // try to get the scene object | 402 | // try to get the scene object |
@@ -416,7 +414,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
416 | } | 414 | } |
417 | 415 | ||
418 | // serialization of client's informations | 416 | // serialization of client's informations |
419 | presences = scene.GetScenePresences(); | 417 | List<ScenePresence> presences = scene.GetScenePresences(); |
420 | 418 | ||
421 | foreach (ScenePresence pre in presences) | 419 | foreach (ScenePresence pre in presences) |
422 | { | 420 | { |
@@ -427,7 +425,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
427 | // serialization of region data | 425 | // serialization of region data |
428 | SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region); | 426 | SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region); |
429 | 427 | ||
430 | filename = export_dir + "RegionInfo_" + src_region.RegionID.ToString() + ".bin"; | 428 | string filename = export_dir + "RegionInfo_" + src_region.RegionID + ".bin"; |
431 | Util.SerializeToFile(filename, dst_region); | 429 | Util.SerializeToFile(filename, dst_region); |
432 | 430 | ||
433 | // backup current scene's entities | 431 | // backup current scene's entities |
@@ -437,10 +435,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
437 | src_region.RegionID.ToString()); | 435 | src_region.RegionID.ToString()); |
438 | } | 436 | } |
439 | 437 | ||
440 | private static void SerializeClient(int idx, Scene scene, ScenePresence pre, string export_dir) | 438 | private static void SerializeClient(int idx, IScene scene, EntityBase pre, string export_dir) |
441 | { | 439 | { |
442 | string filename; | 440 | string filename; |
443 | IClientAPI controller = null; | 441 | IClientAPI controller; |
444 | 442 | ||
445 | m_log.InfoFormat("[BALANCER] " + "agent id : {0}", pre.UUID); | 443 | m_log.InfoFormat("[BALANCER] " + "agent id : {0}", pre.UUID); |
446 | 444 | ||
@@ -454,7 +452,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
454 | { | 452 | { |
455 | ClientInfo info = controller.GetClientInfo(); | 453 | ClientInfo info = controller.GetClientInfo(); |
456 | 454 | ||
457 | filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode.ToString() + ".bin"; | 455 | filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode + ".bin"; |
458 | 456 | ||
459 | Util.SerializeToFile(filename, info); | 457 | Util.SerializeToFile(filename, info); |
460 | 458 | ||
@@ -470,15 +468,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
470 | m_log.InfoFormat("[BALANCER] " + "scene presence serialized [filename={0}]", filename); | 468 | m_log.InfoFormat("[BALANCER] " + "scene presence serialized [filename={0}]", filename); |
471 | } | 469 | } |
472 | 470 | ||
473 | private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir) | 471 | private RegionInfo DeserializeRegion(int dst_port, string import_dir) |
474 | { | 472 | { |
475 | string[] files = null; | ||
476 | RegionInfo dst_region = null; | 473 | RegionInfo dst_region = null; |
477 | 474 | ||
478 | try | 475 | try |
479 | { | 476 | { |
480 | // deserialization of region data | 477 | // deserialization of region data |
481 | files = Directory.GetFiles(import_dir, "RegionInfo_*.bin"); | 478 | string[] files = Directory.GetFiles(import_dir, "RegionInfo_*.bin"); |
482 | 479 | ||
483 | foreach (string filename in files) | 480 | foreach (string filename in files) |
484 | { | 481 | { |
@@ -498,34 +495,37 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
498 | m_log.InfoFormat("[BALANCER] " + "region deserialized [{0}]", dst_region.RegionID); | 495 | m_log.InfoFormat("[BALANCER] " + "region deserialized [{0}]", dst_region.RegionID); |
499 | } | 496 | } |
500 | 497 | ||
501 | // deserialization of client data | 498 | // BUG: This looks dodgy. Johan please look at this. |
502 | DeserializeClient(dst_region, import_dir); | 499 | // Prevent nullreference on zero entry |
500 | if (dst_region != null) | ||
501 | { | ||
502 | // deserialization of client data | ||
503 | DeserializeClient(dst_region, import_dir); | ||
503 | 504 | ||
504 | m_log.InfoFormat("[BALANCER] " + "region deserialization completed [{0}]", | 505 | m_log.InfoFormat("[BALANCER] " + "region deserialization completed [{0}]", |
505 | dst_region.ToString()); | 506 | dst_region.ToString()); |
507 | } | ||
506 | } | 508 | } |
507 | catch (Exception e) | 509 | catch (Exception e) |
508 | { | 510 | { |
509 | m_log.Error("[BALANCER] " + e.ToString()); | 511 | m_log.Error("[BALANCER] " + e); |
510 | m_log.Error("[BALANCER] " + e.StackTrace); | 512 | m_log.Error("[BALANCER] " + e.StackTrace); |
511 | throw e; | 513 | throw; |
512 | } | 514 | } |
513 | 515 | ||
514 | return dst_region; | 516 | return dst_region; |
515 | } | 517 | } |
516 | 518 | ||
517 | private void DeserializeClient(RegionInfo dst_region, string import_dir) | 519 | private void DeserializeClient(SimpleRegionInfo dst_region, string import_dir) |
518 | { | 520 | { |
519 | ScenePresence sp = null; | 521 | ScenePresence sp; |
520 | ClientInfo data = null; | 522 | ClientInfo data; |
521 | Scene scene = null; | 523 | Scene scene; |
522 | string[] files = null; | 524 | IClientAPI controller; |
523 | IClientAPI controller = null; | ||
524 | IClientNetworkServer clientserv = null; | ||
525 | 525 | ||
526 | if (sceneManager.TryGetScene(dst_region.RegionID, out scene)) | 526 | if (sceneManager.TryGetScene(dst_region.RegionID, out scene)) |
527 | { | 527 | { |
528 | clientserv = SearchClientServerFromPortNum(scene.RegionInfo.InternalEndPoint.Port); | 528 | IClientNetworkServer clientserv = SearchClientServerFromPortNum(scene.RegionInfo.InternalEndPoint.Port); |
529 | 529 | ||
530 | // restore the scene presence | 530 | // restore the scene presence |
531 | for (int i = 0;; i++) | 531 | for (int i = 0;; i++) |
@@ -547,7 +547,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
547 | 547 | ||
548 | // restore the ClientView | 548 | // restore the ClientView |
549 | 549 | ||
550 | files = Directory.GetFiles(import_dir, "ClientInfo-" + String.Format("{0:0000}", i) + "_*.bin"); | 550 | string[] files = Directory.GetFiles(import_dir, "ClientInfo-" + String.Format("{0:0000}", i) + "_*.bin"); |
551 | 551 | ||
552 | foreach (string fname in files) | 552 | foreach (string fname in files) |
553 | { | 553 | { |
@@ -634,11 +634,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
634 | } | 634 | } |
635 | } | 635 | } |
636 | 636 | ||
637 | private void RemoveAllClientResource(RegionInfo src_region) | 637 | private void RemoveAllClientResource(SimpleRegionInfo src_region) |
638 | { | 638 | { |
639 | Scene scene = null; | 639 | Scene scene; |
640 | List<ScenePresence> presences; | 640 | IClientAPI controller; |
641 | IClientAPI controller = null; | ||
642 | 641 | ||
643 | // try to get the scene object | 642 | // try to get the scene object |
644 | if (sceneManager.TryGetScene(src_region.RegionID, out scene) == false) | 643 | if (sceneManager.TryGetScene(src_region.RegionID, out scene) == false) |
@@ -648,7 +647,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
648 | } | 647 | } |
649 | 648 | ||
650 | // serialization of client's informations | 649 | // serialization of client's informations |
651 | presences = scene.GetScenePresences(); | 650 | List<ScenePresence> presences = scene.GetScenePresences(); |
652 | 651 | ||
653 | // remove all scene presences | 652 | // remove all scene presences |
654 | foreach (ScenePresence pre in presences) | 653 | foreach (ScenePresence pre in presences) |
@@ -698,11 +697,9 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
698 | sceneURL[i] = (string) request.Params[i + 2 + numRegions]; | 697 | sceneURL[i] = (string) request.Params[i + 2 + numRegions]; |
699 | } | 698 | } |
700 | 699 | ||
701 | string hostname; | ||
702 | |||
703 | for (int i = 0; i < numRegions; i++) | 700 | for (int i = 0; i < numRegions; i++) |
704 | { | 701 | { |
705 | hostname = sceneURL[i].Split(new char[] {'/', ':'})[3]; | 702 | string hostname = sceneURL[i].Split(new char[] {'/', ':'})[3]; |
706 | m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname); | 703 | m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname); |
707 | tcpClientList[i] = new TcpClient(hostname, 10001); | 704 | tcpClientList[i] = new TcpClient(hostname, 10001); |
708 | } | 705 | } |
@@ -720,14 +717,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
720 | if (sceneManager.TryGetScene(region.RegionID, out scene)) | 717 | if (sceneManager.TryGetScene(region.RegionID, out scene)) |
721 | { | 718 | { |
722 | // Disable event updates, backups etc in the slave(s) | 719 | // Disable event updates, backups etc in the slave(s) |
723 | if (isMaster) | 720 | scene.Region_Status = isMaster ? RegionStatus.Up : RegionStatus.SlaveScene; |
724 | { | ||
725 | scene.Region_Status = RegionStatus.Up; | ||
726 | } | ||
727 | else | ||
728 | { | ||
729 | scene.Region_Status = RegionStatus.SlaveScene; | ||
730 | } | ||
731 | 721 | ||
732 | //Console.WriteLine("=== SplitRegion {0}: Scene found, status {1}", region.RegionID, scene.Region_Status); | 722 | //Console.WriteLine("=== SplitRegion {0}: Scene found, status {1}", region.RegionID, scene.Region_Status); |
733 | 723 | ||
@@ -738,12 +728,11 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
738 | List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); | 728 | List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); |
739 | circuits.Sort(); | 729 | circuits.Sort(); |
740 | 730 | ||
741 | IClientAPI controller = null; | ||
742 | |||
743 | foreach (uint code in circuits) | 731 | foreach (uint code in circuits) |
744 | { | 732 | { |
745 | m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code); | 733 | m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code); |
746 | 734 | ||
735 | IClientAPI controller; | ||
747 | if (scene.ClientManager.TryGetClient(code, out controller)) | 736 | if (scene.ClientManager.TryGetClient(code, out controller)) |
748 | { | 737 | { |
749 | // Divide the presences evenly over the set of subscenes | 738 | // Divide the presences evenly over the set of subscenes |
@@ -763,7 +752,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
763 | } | 752 | } |
764 | 753 | ||
765 | scene.splitID = myID; | 754 | scene.splitID = myID; |
766 | scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes); | 755 | scene.SynchronizeScene = SynchronizeScenes; |
767 | isSplit = true; | 756 | isSplit = true; |
768 | } | 757 | } |
769 | else | 758 | else |
@@ -773,7 +762,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
773 | } | 762 | } |
774 | catch (Exception e) | 763 | catch (Exception e) |
775 | { | 764 | { |
776 | m_log.Error("[SPLITSCENE] " + e.ToString()); | 765 | m_log.Error("[SPLITSCENE] " + e); |
777 | m_log.Error("[SPLITSCENE] " + e.StackTrace); | 766 | m_log.Error("[SPLITSCENE] " + e.StackTrace); |
778 | } | 767 | } |
779 | 768 | ||
@@ -827,9 +816,9 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
827 | } | 816 | } |
828 | catch (Exception e) | 817 | catch (Exception e) |
829 | { | 818 | { |
830 | m_log.Error("[BALANCER] " + e.ToString()); | 819 | m_log.Error("[BALANCER] " + e); |
831 | m_log.Error("[BALANCER] " + e.StackTrace); | 820 | m_log.Error("[BALANCER] " + e.StackTrace); |
832 | throw e; | 821 | throw; |
833 | } | 822 | } |
834 | 823 | ||
835 | return new XmlRpcResponse(); | 824 | return new XmlRpcResponse(); |
@@ -900,7 +889,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
900 | // Because data changes by the physics simulation when the client doesn't move, | 889 | // Because data changes by the physics simulation when the client doesn't move, |
901 | // if MovementFlag is false, It is necessary to synchronize. | 890 | // if MovementFlag is false, It is necessary to synchronize. |
902 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) | 891 | //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) |
903 | if (client.IsActive == true) | 892 | if (client.IsActive) |
904 | { | 893 | { |
905 | //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition)); | 894 | //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition)); |
906 | 895 | ||
@@ -1047,12 +1036,10 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1047 | { | 1036 | { |
1048 | case 0: | 1037 | case 0: |
1049 | 1038 | ||
1050 | Packet packet = null; | ||
1051 | byte[] zero = new byte[3000]; | 1039 | byte[] zero = new byte[3000]; |
1052 | int packetEnd = 0; | ||
1053 | 1040 | ||
1054 | // deserialize packet | 1041 | // deserialize packet |
1055 | packetEnd = buff.Length - 1; | 1042 | int packetEnd = buff.Length - 1; |
1056 | // packetEnd = buff.Length; | 1043 | // packetEnd = buff.Length; |
1057 | 1044 | ||
1058 | try | 1045 | try |
@@ -1060,14 +1047,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1060 | //m_log.Info("[SPLITSCENE] "+"PacketPool.Instance : {0}", (PacketPool.Instance == null)?"null":"not null"); | 1047 | //m_log.Info("[SPLITSCENE] "+"PacketPool.Instance : {0}", (PacketPool.Instance == null)?"null":"not null"); |
1061 | //m_log.Info("[SPLITSCENE] "+"buff length={0}", buff.Length); | 1048 | //m_log.Info("[SPLITSCENE] "+"buff length={0}", buff.Length); |
1062 | 1049 | ||
1063 | packet = PacketPool.Instance.GetPacket(buff, ref packetEnd, zero); | 1050 | Packet packet = PacketPool.Instance.GetPacket(buff, ref packetEnd, zero); |
1064 | 1051 | ||
1065 | LocalUpdatePacket(header.region_port, new LLUUID(header.agent_id), | 1052 | LocalUpdatePacket(header.region_port, new LLUUID(header.agent_id), |
1066 | packet, (ThrottleOutPacketType) header.throttlePacketType); | 1053 | packet, (ThrottleOutPacketType) header.throttlePacketType); |
1067 | } | 1054 | } |
1068 | catch (Exception e) | 1055 | catch (Exception e) |
1069 | { | 1056 | { |
1070 | m_log.Error("[SPLITSCENE] " + e.ToString()); | 1057 | m_log.Error("[SPLITSCENE] " + e); |
1071 | m_log.Error("[SPLITSCENE] " + e.StackTrace); | 1058 | m_log.Error("[SPLITSCENE] " + e.StackTrace); |
1072 | } | 1059 | } |
1073 | 1060 | ||
@@ -1079,7 +1066,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer | |||
1079 | LLUUID scenePresenceID = new LLUUID(header.agent_id); | 1066 | LLUUID scenePresenceID = new LLUUID(header.agent_id); |
1080 | LLVector3 position = new LLVector3(buff, 0); | 1067 | LLVector3 position = new LLVector3(buff, 0); |
1081 | LLVector3 velocity = new LLVector3(buff, 12); | 1068 | LLVector3 velocity = new LLVector3(buff, 12); |
1082 | bool flying = ((buff[24] == (byte) 1) ? true : false); | 1069 | bool flying = ((buff[24] == 1) ? true : false); |
1083 | 1070 | ||
1084 | LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying); | 1071 | LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying); |
1085 | 1072 | ||