aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/HypergridLinker.cs
diff options
context:
space:
mode:
authorMarck2010-12-10 17:48:45 +0100
committerMarck2010-12-10 17:48:45 +0100
commit6f37290f4ccf0d3e516edcc38406cffaf35bcaac (patch)
treedc2462cea0a59bf7e32f28c70e6ef537a70b4677 /OpenSim/Services/GridService/HypergridLinker.cs
parentupdate libode for 64 bit linux to r1755 (post 0.11.1) from ode 0.10.1 (diff)
downloadopensim-SC-6f37290f4ccf0d3e516edcc38406cffaf35bcaac.zip
opensim-SC-6f37290f4ccf0d3e516edcc38406cffaf35bcaac.tar.gz
opensim-SC-6f37290f4ccf0d3e516edcc38406cffaf35bcaac.tar.bz2
opensim-SC-6f37290f4ccf0d3e516edcc38406cffaf35bcaac.tar.xz
Adjust hypergrid console commands to latest changes.
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs105
1 files changed, 41 insertions, 64 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 31c7b80..9863ba0 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Linq; 31using System.Linq;
31using System.Net; 32using System.Net;
@@ -244,7 +245,9 @@ namespace OpenSim.Services.GridService
244 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); 245 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
245 if (region != null) 246 if (region != null)
246 { 247 {
247 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", regInfo.RegionLocX, regInfo.RegionLocY, region.RegionName, region.RegionID); 248 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}",
249 regInfo.RegionLocX / Constants.RegionSize, regInfo.RegionLocY / Constants.RegionSize,
250 region.RegionName, region.RegionID);
248 reason = "Coordinates are already in use"; 251 reason = "Coordinates are already in use";
249 return false; 252 return false;
250 } 253 }
@@ -273,7 +276,8 @@ namespace OpenSim.Services.GridService
273 region = m_GridService.GetRegionByUUID(scopeID, regionID); 276 region = m_GridService.GetRegionByUUID(scopeID, regionID);
274 if (region != null) 277 if (region != null)
275 { 278 {
276 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); 279 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}",
280 region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
277 regInfo = region; 281 regInfo = region;
278 return true; 282 return true;
279 } 283 }
@@ -425,15 +429,14 @@ namespace OpenSim.Services.GridService
425 return; 429 return;
426 } 430 }
427 431
428 MainConsole.Instance.Output("Region Name Region UUID"); 432 MainConsole.Instance.Output("Region Name");
429 MainConsole.Instance.Output("Location URI"); 433 MainConsole.Instance.Output("Location Region UUID");
430 MainConsole.Instance.Output("-------------------------------------------------------------------------------"); 434 MainConsole.Instance.Output(new string('-', 72));
431 foreach (RegionData r in regions) 435 foreach (RegionData r in regions)
432 { 436 {
433 MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n", 437 MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n",
434 r.RegionName, r.RegionID, 438 r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY,
435 String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256), 439 r.posX / Constants.RegionSize, r.posY / Constants.RegionSize)));
436 r.Data["serverURI"].ToString()));
437 } 440 }
438 return; 441 return;
439 } 442 }
@@ -461,11 +464,14 @@ namespace OpenSim.Services.GridService
461 xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; 464 xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
462 yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; 465 yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
463 serverURI = cmdparams[2]; 466 serverURI = cmdparams[2];
464 if (cmdparams.Length == 4) 467 if (cmdparams.Length > 3)
465 remoteName = cmdparams[3]; 468 remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3);
466 string reason = string.Empty; 469 string reason = string.Empty;
467 GridRegion regInfo; 470 GridRegion regInfo;
468 TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason); 471 if (TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason))
472 MainConsole.Instance.Output("Hyperlink established");
473 else
474 MainConsole.Instance.Output("Failed to link region: " + reason);
469 } 475 }
470 476
471 private void RunHGCommand(string command, string[] cmdparams) 477 private void RunHGCommand(string command, string[] cmdparams)
@@ -490,18 +496,6 @@ namespace OpenSim.Services.GridService
490 } 496 }
491 else if (command.Equals("link-region")) 497 else if (command.Equals("link-region"))
492 { 498 {
493 if (cmdparams.Length > 0 && cmdparams.Length < 5)
494 {
495 RunLinkRegionCommand(cmdparams);
496 }
497 else
498 {
499 LinkRegionCmdUsage();
500 }
501 return;
502 }
503 else if (command.Equals("link-region"))
504 {
505 if (cmdparams.Length < 3) 499 if (cmdparams.Length < 3)
506 { 500 {
507 if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) 501 if ((cmdparams.Length == 1) || (cmdparams.Length == 2))
@@ -516,40 +510,24 @@ namespace OpenSim.Services.GridService
516 } 510 }
517 511
518 //this should be the prefererred way of setting up hg links now 512 //this should be the prefererred way of setting up hg links now
519 if ( cmdparams[2].StartsWith("http") && ( cmdparams.Length >= 3 && cmdparams.Length <= 5 )) { 513 if (cmdparams[2].StartsWith("http"))
514 {
520 RunLinkRegionCommand(cmdparams); 515 RunLinkRegionCommand(cmdparams);
521 } 516 }
522 else if (cmdparams[2].Contains(":")) 517 else if (cmdparams[2].Contains(":"))
523 { 518 {
524 // New format 519 // New format
525 int xloc, yloc; 520 string[] parts = cmdparams[2].Split(':');
526 string mapName; 521 if (parts.Length > 2)
527 try
528 {
529 xloc = Convert.ToInt32(cmdparams[0]);
530 yloc = Convert.ToInt32(cmdparams[1]);
531 mapName = cmdparams[2];
532 if (cmdparams.Length > 3)
533 for (int i = 3; i < cmdparams.Length; i++)
534 mapName += " " + cmdparams[i];
535
536 //m_log.Info(">> MapName: " + mapName);
537 }
538 catch (Exception e)
539 { 522 {
540 MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message); 523 // Insert remote region name
541 LinkRegionCmdUsage(); 524 ArrayList parameters = new ArrayList(cmdparams);
542 return; 525 parameters.Insert(3, parts[2]);
526 cmdparams = (string[])parameters.ToArray(typeof(string));
543 } 527 }
528 cmdparams[2] = "http://" + parts[0] + ':' + parts[1];
544 529
545 // Convert cell coordinates given by the user to meters 530 RunLinkRegionCommand(cmdparams);
546 xloc = xloc * (int)Constants.RegionSize;
547 yloc = yloc * (int)Constants.RegionSize;
548 string reason = string.Empty;
549 if (TryLinkRegionToCoords(UUID.Zero, mapName, xloc, yloc, out reason) == null)
550 MainConsole.Instance.Output("Failed to link region: " + reason);
551 else
552 MainConsole.Instance.Output("Hyperlink established");
553 } 531 }
554 else 532 else
555 { 533 {
@@ -558,16 +536,12 @@ namespace OpenSim.Services.GridService
558 int xloc, yloc; 536 int xloc, yloc;
559 uint externalPort; 537 uint externalPort;
560 string externalHostName; 538 string externalHostName;
561 string serverURI;
562 try 539 try
563 { 540 {
564 xloc = Convert.ToInt32(cmdparams[0]); 541 xloc = Convert.ToInt32(cmdparams[0]);
565 yloc = Convert.ToInt32(cmdparams[1]); 542 yloc = Convert.ToInt32(cmdparams[1]);
566 externalPort = Convert.ToUInt32(cmdparams[3]); 543 externalPort = Convert.ToUInt32(cmdparams[3]);
567 externalHostName = cmdparams[2]; 544 externalHostName = cmdparams[2];
568 if ( cmdparams.Length == 4 ) {
569
570 }
571 //internalPort = Convert.ToUInt32(cmdparams[4]); 545 //internalPort = Convert.ToUInt32(cmdparams[4]);
572 //remotingPort = Convert.ToUInt32(cmdparams[5]); 546 //remotingPort = Convert.ToUInt32(cmdparams[5]);
573 } 547 }
@@ -584,27 +558,30 @@ namespace OpenSim.Services.GridService
584 string reason = string.Empty; 558 string reason = string.Empty;
585 if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) 559 if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
586 { 560 {
587 if (cmdparams.Length >= 5) 561 // What is this? The GridRegion instance will be discarded anyway,
588 { 562 // which effectively ignores any local name given with the command.
589 regInfo.RegionName = ""; 563 //if (cmdparams.Length >= 5)
590 for (int i = 4; i < cmdparams.Length; i++) 564 //{
591 regInfo.RegionName += cmdparams[i] + " "; 565 // regInfo.RegionName = "";
592 } 566 // for (int i = 4; i < cmdparams.Length; i++)
567 // regInfo.RegionName += cmdparams[i] + " ";
568 //}
593 } 569 }
594 } 570 }
595 return; 571 return;
596 } 572 }
597 else if (command.Equals("unlink-region")) 573 else if (command.Equals("unlink-region"))
598 { 574 {
599 if (cmdparams.Length < 1 || cmdparams.Length > 1) 575 if (cmdparams.Length < 1)
600 { 576 {
601 UnlinkRegionCmdUsage(); 577 UnlinkRegionCmdUsage();
602 return; 578 return;
603 } 579 }
604 if (TryUnlinkRegion(cmdparams[0])) 580 string region = string.Join(" ", cmdparams);
605 MainConsole.Instance.Output("Successfully unlinked " + cmdparams[0]); 581 if (TryUnlinkRegion(region))
582 MainConsole.Instance.Output("Successfully unlinked " + region);
606 else 583 else
607 MainConsole.Instance.Output("Unable to unlink " + cmdparams[0] + ", region not found."); 584 MainConsole.Instance.Output("Unable to unlink " + region + ", region not found.");
608 } 585 }
609 } 586 }
610 587