aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs297
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs54
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs52
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs19
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs63
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs10
10 files changed, 443 insertions, 74 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
index 36915ef..0974372 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
86 86
87 private void RunHGCommand(string command, string[] cmdparams) 87 private void RunHGCommand(string command, string[] cmdparams)
88 { 88 {
89 if (command.Equals("linkk-mapping")) 89 if (command.Equals("link-mapping"))
90 { 90 {
91 if (cmdparams.Length == 2) 91 if (cmdparams.Length == 2)
92 { 92 {
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
104 } 104 }
105 } 105 }
106 } 106 }
107 else if (command.Equals("linkk-region")) 107 else if (command.Equals("link-region"))
108 { 108 {
109 if (cmdparams.Length < 3) 109 if (cmdparams.Length < 3)
110 { 110 {
@@ -187,7 +187,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
187 } 187 }
188 return; 188 return;
189 } 189 }
190 else if (command.Equals("unlinkk-region")) 190 else if (command.Equals("unlink-region"))
191 { 191 {
192 if (cmdparams.Length < 1) 192 if (cmdparams.Length < 1)
193 { 193 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index 0c2a835..1eb481e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -31,6 +31,7 @@ using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33 33
34using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -47,15 +48,19 @@ using Nini.Config;
47 48
48namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 49namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
49{ 50{
50 public class HGGridConnector : ISharedRegionModule, IGridService 51 public class HGGridConnector : ISharedRegionModule, IGridService, IHyperlinkService
51 { 52 {
52 private static readonly ILog m_log = 53 private static readonly ILog m_log =
53 LogManager.GetLogger( 54 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 55 MethodBase.GetCurrentMethod().DeclaringType);
56 private static string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI;
55 57
56 private bool m_Enabled = false; 58 private bool m_Enabled = false;
57 private bool m_Initialized = false; 59 private bool m_Initialized = false;
58 60
61 private Scene m_aScene;
62 private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
63
59 private IGridService m_GridServiceConnector; 64 private IGridService m_GridServiceConnector;
60 private HypergridServiceConnector m_HypergridServiceConnector; 65 private HypergridServiceConnector m_HypergridServiceConnector;
61 66
@@ -130,6 +135,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
130 135
131 public void PostInitialise() 136 public void PostInitialise()
132 { 137 {
138 if (m_Enabled)
139 ((ISharedRegionModule)m_GridServiceConnector).PostInitialise();
133 } 140 }
134 141
135 public void Close() 142 public void Close()
@@ -141,12 +148,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
141 if (!m_Enabled) 148 if (!m_Enabled)
142 return; 149 return;
143 150
151 m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
144 scene.RegisterModuleInterface<IGridService>(this); 152 scene.RegisterModuleInterface<IGridService>(this);
153 scene.RegisterModuleInterface<IHyperlinkService>(this);
154
155 ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
145 156
146 } 157 }
147 158
148 public void RemoveRegion(Scene scene) 159 public void RemoveRegion(Scene scene)
149 { 160 {
161 if (m_Enabled)
162 {
163 m_LocalScenes.Remove(scene.RegionInfo.RegionHandle);
164 ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene);
165 }
150 } 166 }
151 167
152 public void RegionLoaded(Scene scene) 168 public void RegionLoaded(Scene scene)
@@ -156,29 +172,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
156 172
157 if (!m_Initialized) 173 if (!m_Initialized)
158 { 174 {
175 m_aScene = scene;
176 LocalAssetServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL;
177 LocalInventoryServerURI = m_aScene.CommsManager.NetworkServersInfo.InventoryURL;
178 LocalUserServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL;
179
159 m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService); 180 m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService);
181
160 HGCommands hgCommands = new HGCommands(this, scene); 182 HGCommands hgCommands = new HGCommands(this, scene);
161 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "linkk-region", 183 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-region",
162 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", 184 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
163 "Link a hypergrid region", hgCommands.RunCommand); 185 "Link a hypergrid region", hgCommands.RunCommand);
164 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "unlinkk-region", 186 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "unlink-region",
165 "unlink-region <local name> or <HostName>:<HttpPort> <cr>", 187 "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
166 "Unlink a hypergrid region", hgCommands.RunCommand); 188 "Unlink a hypergrid region", hgCommands.RunCommand);
167 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "linkk-mapping", "link-mapping [<x> <y>] <cr>", 189 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
168 "Set local coordinate to map HG regions to", hgCommands.RunCommand); 190 "Set local coordinate to map HG regions to", hgCommands.RunCommand);
169 m_Initialized = true;
170 }
171 191
192 // Yikes!! Remove this as soon as user services get refactored
193 HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI);
172 194
173 //scene.AddCommand("HGGridServicesConnector", "linkk-region", 195 m_Initialized = true;
174 // "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", 196 }
175 // "Link a hypergrid region", hgCommands.RunCommand);
176 //scene.AddCommand("HGGridServicesConnector", "unlinkk-region",
177 // "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
178 // "Unlink a hypergrid region", hgCommands.RunCommand);
179 //scene.AddCommand("HGGridServicesConnector", "linkk-mapping", "link-mapping [<x> <y>] <cr>",
180 // "Set local coordinate to map HG regions to", hgCommands.RunCommand);
181
182 } 197 }
183 198
184 #endregion 199 #endregion
@@ -250,7 +265,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
250 // Try the foreign users home collection 265 // Try the foreign users home collection
251 foreach (GridRegion r in m_knownRegions.Values) 266 foreach (GridRegion r in m_knownRegions.Values)
252 if (r.RegionID == regionID) 267 if (r.RegionID == regionID)
253 return m_knownRegions[regionID]; 268 return r;
254 269
255 // Finally, try the normal route 270 // Finally, try the normal route
256 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID); 271 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
@@ -271,7 +286,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
271 foreach (GridRegion r in m_knownRegions.Values) 286 foreach (GridRegion r in m_knownRegions.Values)
272 { 287 {
273 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY)) 288 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY))
289 {
274 return r; 290 return r;
291 }
275 } 292 }
276 293
277 // Finally, try the normal route 294 // Finally, try the normal route
@@ -338,8 +355,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
338 355
339 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) 356 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
340 { 357 {
341 m_HyperlinkRegions.Add(regionInfo.RegionID, regionInfo); 358 m_HyperlinkRegions[regionInfo.RegionID] = regionInfo;
342 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle); 359 m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
343 } 360 }
344 361
345 private void RemoveHyperlinkRegion(UUID regionID) 362 private void RemoveHyperlinkRegion(UUID regionID)
@@ -350,8 +367,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
350 367
351 private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle) 368 private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle)
352 { 369 {
353 m_knownRegions.Add(userID, regionInfo); 370 m_knownRegions[userID] = regionInfo;
354 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle); 371 m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
355 } 372 }
356 373
357 private void RemoveHyperlinkHomeRegion(UUID regionID) 374 private void RemoveHyperlinkHomeRegion(UUID regionID)
@@ -367,10 +384,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
367 } 384 }
368 #endregion 385 #endregion
369 386
370 #region Hyperlinks 387 #region IHyperlinkService
371 388
372 private static Random random = new Random(); 389 private static Random random = new Random();
373 390
391
374 public GridRegion TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, int xloc, int yloc) 392 public GridRegion TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, int xloc, int yloc)
375 { 393 {
376 string host = "127.0.0.1"; 394 string host = "127.0.0.1";
@@ -417,10 +435,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
417 return null; 435 return null;
418 } 436 }
419 437
438
420 // From the map search and secondlife://blah 439 // From the map search and secondlife://blah
421 public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName) 440 public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
422 { 441 {
423 int xloc = random.Next(0, Int16.MaxValue); 442 int xloc = random.Next(0, Int16.MaxValue) * (int) Constants.RegionSize;
424 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0); 443 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0);
425 } 444 }
426 445
@@ -447,15 +466,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
447 } 466 }
448 467
449 // Finally, link it 468 // Finally, link it
450 try 469 if (!RegisterRegion(UUID.Zero, regInfo))
451 { 470 {
452 RegisterRegion(UUID.Zero, regInfo); 471 m_log.Warn("[HGrid]: Unable to link region");
453 } 472 return false;
454 catch (Exception e) 473 }
455 {
456 m_log.Warn("[HGrid]: Unable to link region: " + e.Message);
457 return false;
458 }
459 474
460 int x, y; 475 int x, y;
461 if (!Check4096(m_scene, regInfo, out x, out y)) 476 if (!Check4096(m_scene, regInfo, out x, out y))
@@ -554,7 +569,227 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
554 return true; 569 return true;
555 } 570 }
556 571
572 public GridRegion TryLinkRegion(IClientAPI client, string regionDescriptor)
573 {
574 return TryLinkRegion((Scene)client.Scene, client, regionDescriptor);
575 }
576
577 public GridRegion GetHyperlinkRegion(ulong handle)
578 {
579 foreach (GridRegion r in m_HyperlinkRegions.Values)
580 if (r.RegionHandle == handle)
581 return r;
582 foreach (GridRegion r in m_knownRegions.Values)
583 if (r.RegionHandle == handle)
584 return r;
585 return null;
586 }
587
588 public ulong FindRegionHandle(ulong handle)
589 {
590 foreach (GridRegion r in m_HyperlinkRegions.Values)
591 if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
592 return m_HyperlinkHandles[r.RegionID];
593
594 foreach (GridRegion r in m_knownRegions.Values)
595 if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
596 return m_HyperlinkHandles[r.RegionID];
597
598 return handle;
599 }
600
601 public bool SendUserInformation(GridRegion regInfo, AgentCircuitData agentData)
602 {
603 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
604
605 if ((IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) ||
606 (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo)))
607 {
608 m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere");
609
610 // Set the position of the region on the remote grid
611 ulong realHandle = FindRegionHandle(regInfo.RegionHandle);
612 uint x = 0, y = 0;
613 Utils.LongToUInts(regInfo.RegionHandle, out x, out y);
614 GridRegion clonedRegion = new GridRegion(regInfo);
615 clonedRegion.RegionLocX = (int)x;
616 clonedRegion.RegionLocY = (int)y;
617
618 // Get the user's home region information
619 GridRegion home = m_aScene.GridService.GetRegionByUUID(m_aScene.RegionInfo.ScopeID, uinfo.UserProfile.HomeRegionID);
620
621 // Get the user's service URLs
622 string serverURI = "";
623 if (uinfo.UserProfile is ForeignUserProfileData)
624 serverURI = Util.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
625 string userServer = (serverURI == "") || (serverURI == null) ? LocalUserServerURI : serverURI;
626
627 string assetServer = Util.ServerURI(uinfo.UserProfile.UserAssetURI);
628 if ((assetServer == null) || (assetServer == ""))
629 assetServer = LocalAssetServerURI;
630
631 string inventoryServer = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
632 if ((inventoryServer == null) || (inventoryServer == ""))
633 inventoryServer = LocalInventoryServerURI;
634
635 if (!m_HypergridServiceConnector.InformRegionOfUser(clonedRegion, agentData, home, userServer, assetServer, inventoryServer))
636 {
637 m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
638 return false;
639 }
640 }
641 //if ((uinfo == null) || !IsGoingHome(uinfo, regInfo))
642 //{
643 // m_log.Info("[HGrid]: User seems to be going to foreign region.");
644 // if (!InformRegionOfUser(regInfo, agentData))
645 // {
646 // m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
647 // return false;
648 // }
649 //}
650 //else
651 // m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
652
653 // May need to change agent's name
654 if (IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null))
655 {
656 agentData.firstname = agentData.firstname + "." + agentData.lastname;
657 agentData.lastname = "@" + LocalUserServerURI.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
658 }
659
660 return true;
661 }
662
663 public void AdjustUserInformation(AgentCircuitData agentData)
664 {
665 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
666 if ((uinfo != null) && (uinfo.UserProfile != null) &&
667 (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData)))
668 {
669 //m_log.Debug("---------------> Local User!");
670 string[] parts = agentData.firstname.Split(new char[] { '.' });
671 if (parts.Length == 2)
672 {
673 agentData.firstname = parts[0];
674 agentData.lastname = parts[1];
675 }
676 }
677 //else
678 // m_log.Debug("---------------> Foreign User!");
679 }
680
681 // Check if a local user exists with the same UUID as the incoming foreign user
682 public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome)
683 {
684 comingHome = false;
685 if (!m_aScene.SceneGridService.RegionLoginsEnabled)
686 return false;
687
688 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
689 if (uinfo != null)
690 {
691 // uh-oh we have a potential intruder
692 if (uinfo.SessionID != sessionID)
693 // can't have a foreigner with a local UUID
694 return false;
695 else
696 // oh, so it's you! welcome back
697 comingHome = true;
698 }
699
700 // OK, user can come in
701 return true;
702 }
703
704 public void AcceptUser(ForeignUserProfileData user, GridRegion home)
705 {
706 m_aScene.CommsManager.UserProfileCacheService.PreloadUserCache(user);
707 ulong realHandle = home.RegionHandle;
708 // Change the local coordinates
709 // X=0 on the map
710 home.RegionLocX = 0;
711 home.RegionLocY = random.Next(0, 10000) * (int)Constants.RegionSize;
712
713 AddHyperlinkHomeRegion(user.ID, home, realHandle);
714
715 DumpUserData(user);
716 DumpRegionData(home);
717
718 }
719
720 public bool IsLocalUser(UUID userID)
721 {
722 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
723 return IsLocalUser(uinfo);
724 }
725
557 #endregion 726 #endregion
558 727
728 #region IHyperlink Misc
729
730 protected bool IsComingHome(ForeignUserProfileData userData)
731 {
732 return (userData.UserServerURI == LocalUserServerURI);
733 }
734
735 // Is the user going back to the home region or the home grid?
736 protected bool IsGoingHome(CachedUserInfo uinfo, GridRegion rinfo)
737 {
738 if (uinfo.UserProfile == null)
739 return false;
740
741 if (!(uinfo.UserProfile is ForeignUserProfileData))
742 // it's a home user, can't be outside to return home
743 return false;
744
745 // OK, it's a foreign user with a ForeignUserProfileData
746 // and is going back to exactly the home region.
747 // We can't check if it's going back to a non-home region
748 // of the home grid. That will be dealt with in the
749 // receiving end
750 return (uinfo.UserProfile.HomeRegionID == rinfo.RegionID);
751 }
752
753 protected bool IsLocalUser(CachedUserInfo uinfo)
754 {
755 if (uinfo == null)
756 return false;
757
758 return !(uinfo.UserProfile is ForeignUserProfileData);
759
760 }
761
762 protected bool IsLocalRegion(ulong handle)
763 {
764 return m_LocalScenes.ContainsKey(handle);
765 }
766
767 private void DumpUserData(ForeignUserProfileData userData)
768 {
769 m_log.Info(" ------------ User Data Dump ----------");
770 m_log.Info(" >> Name: " + userData.FirstName + " " + userData.SurName);
771 m_log.Info(" >> HomeID: " + userData.HomeRegionID);
772 m_log.Info(" >> UserServer: " + userData.UserServerURI);
773 m_log.Info(" >> InvServer: " + userData.UserInventoryURI);
774 m_log.Info(" >> AssetServer: " + userData.UserAssetURI);
775 m_log.Info(" ------------ -------------- ----------");
776 }
777
778 private void DumpRegionData(GridRegion rinfo)
779 {
780 m_log.Info(" ------------ Region Data Dump ----------");
781 m_log.Info(" >> handle: " + rinfo.RegionHandle);
782 m_log.Info(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY);
783 m_log.Info(" >> external host name: " + rinfo.ExternalHostName);
784 m_log.Info(" >> http port: " + rinfo.HttpPort);
785 m_log.Info(" >> external EP address: " + rinfo.ExternalEndPoint.Address);
786 m_log.Info(" >> external EP port: " + rinfo.ExternalEndPoint.Port);
787 m_log.Info(" ------------ -------------- ----------");
788 }
789
790
791 #endregion
792
793
559 } 794 }
560} 795}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 743d3b9..6c2928a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -31,6 +31,7 @@ using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console;
34using OpenSim.Server.Base; 35using OpenSim.Server.Base;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -47,7 +48,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
47 LogManager.GetLogger( 48 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType); 49 MethodBase.GetCurrentMethod().DeclaringType);
49 50
51 private static LocalGridServicesConnector m_MainInstance;
52
50 private IGridService m_GridService; 53 private IGridService m_GridService;
54 private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>();
51 55
52 private bool m_Enabled = false; 56 private bool m_Enabled = false;
53 57
@@ -58,6 +62,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
58 public LocalGridServicesConnector(IConfigSource source) 62 public LocalGridServicesConnector(IConfigSource source)
59 { 63 {
60 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); 64 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated");
65 m_MainInstance = this;
61 InitialiseService(source); 66 InitialiseService(source);
62 } 67 }
63 68
@@ -82,6 +87,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
82 if (name == Name) 87 if (name == Name)
83 { 88 {
84 InitialiseService(source); 89 InitialiseService(source);
90 m_MainInstance = this;
85 m_Enabled = true; 91 m_Enabled = true;
86 m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); 92 m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled");
87 } 93 }
@@ -120,6 +126,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
120 126
121 public void PostInitialise() 127 public void PostInitialise()
122 { 128 {
129 if (m_MainInstance == this)
130 {
131 MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours",
132 "show neighbours",
133 "Shows the local regions' neighbours", NeighboursCommand);
134 }
123 } 135 }
124 136
125 public void Close() 137 public void Close()
@@ -128,14 +140,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
128 140
129 public void AddRegion(Scene scene) 141 public void AddRegion(Scene scene)
130 { 142 {
131 if (!m_Enabled) 143 if (m_Enabled)
132 return; 144 scene.RegisterModuleInterface<IGridService>(this);
145
146 if (m_MainInstance == this)
147 {
148 if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
149 m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
150 else
151 m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
133 152
134 scene.RegisterModuleInterface<IGridService>(this); 153 }
135 } 154 }
136 155
137 public void RemoveRegion(Scene scene) 156 public void RemoveRegion(Scene scene)
138 { 157 {
158 if (m_MainInstance == this)
159 {
160 m_LocalCache[scene.RegionInfo.RegionID].Clear();
161 m_LocalCache.Remove(scene.RegionInfo.RegionID);
162 }
139 } 163 }
140 164
141 public void RegionLoaded(Scene scene) 165 public void RegionLoaded(Scene scene)
@@ -158,7 +182,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
158 182
159 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) 183 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
160 { 184 {
161 return m_GridService.GetNeighbours(scopeID, regionID); 185 if (m_LocalCache.ContainsKey(regionID))
186 {
187 return m_LocalCache[regionID].GetNeighbours();
188 }
189 else
190 {
191 m_log.WarnFormat("[LOCAL GRID CONNECTOR]: GetNeighbours: Requested region {0} is not on this sim", regionID);
192 return new List<GridRegion>();
193 }
194
195 // Don't go to the DB
196 //return m_GridService.GetNeighbours(scopeID, regionID);
162 } 197 }
163 198
164 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) 199 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
@@ -187,5 +222,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
187 } 222 }
188 223
189 #endregion 224 #endregion
225
226 public void NeighboursCommand(string module, string[] cmdparams)
227 {
228 foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache)
229 {
230 m_log.InfoFormat("*** Neighbours of {0} {1} ***", kvp.Key, kvp.Value.RegionName);
231 List<GridRegion> regions = kvp.Value.GetNeighbours();
232 foreach (GridRegion r in regions)
233 m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
234 }
235 }
190 } 236 }
191} 237}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
new file mode 100644
index 0000000..ea205a2
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
@@ -0,0 +1,52 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4
5using OpenSim.Region.Framework.Scenes;
6using OpenSim.Services.Interfaces;
7using GridRegion = OpenSim.Services.Interfaces.GridRegion;
8
9using log4net;
10
11namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
12{
13 public class RegionCache
14 {
15 private static readonly ILog m_log =
16 LogManager.GetLogger(
17 MethodBase.GetCurrentMethod().DeclaringType);
18
19 private Scene m_scene;
20 private Dictionary<ulong, GridRegion> m_neighbours = new Dictionary<ulong, GridRegion>();
21
22 public string RegionName
23 {
24 get { return m_scene.RegionInfo.RegionName; }
25 }
26
27 public RegionCache(Scene s)
28 {
29 m_scene = s;
30 m_scene.EventManager.OnRegionUp += OnRegionUp;
31 }
32
33 private void OnRegionUp(GridRegion otherRegion)
34 {
35 m_log.DebugFormat("[REGION CACHE]: (on region {0}) Region {1} is up @ {2}-{3}",
36 m_scene.RegionInfo.RegionName, otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY);
37
38 m_neighbours[otherRegion.RegionHandle] = otherRegion;
39 }
40
41 public void Clear()
42 {
43 m_scene.EventManager.OnRegionUp -= OnRegionUp;
44 m_neighbours.Clear();
45 }
46
47 public List<GridRegion> GetNeighbours()
48 {
49 return new List<GridRegion>(m_neighbours.Values);
50 }
51 }
52}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 91a808b..72c00fc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -104,6 +104,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
104 104
105 public void PostInitialise() 105 public void PostInitialise()
106 { 106 {
107 if (m_LocalGridService != null)
108 ((ISharedRegionModule)m_LocalGridService).PostInitialise();
107 } 109 }
108 110
109 public void Close() 111 public void Close()
@@ -112,14 +114,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
112 114
113 public void AddRegion(Scene scene) 115 public void AddRegion(Scene scene)
114 { 116 {
115 if (!m_Enabled) 117 if (m_Enabled)
116 return; 118 scene.RegisterModuleInterface<IGridService>(this);
117 119
118 scene.RegisterModuleInterface<IGridService>(this); 120 if (m_LocalGridService != null)
121 ((ISharedRegionModule)m_LocalGridService).AddRegion(scene);
119 } 122 }
120 123
121 public void RemoveRegion(Scene scene) 124 public void RemoveRegion(Scene scene)
122 { 125 {
126 if (m_LocalGridService != null)
127 ((ISharedRegionModule)m_LocalGridService).RemoveRegion(scene);
123 } 128 }
124 129
125 public void RegionLoaded(Scene scene) 130 public void RegionLoaded(Scene scene)
@@ -146,7 +151,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
146 return false; 151 return false;
147 } 152 }
148 153
149 // Let's not override GetNeighbours -- let's get them all from the grid server 154 // Let's override GetNeighbours completely -- never go to the grid server
155 // Neighbours are/should be cached locally
156 // For retrieval from the DB, caller should call GetRegionByPosition
157 public override List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
158 {
159 return m_LocalGridService.GetNeighbours(scopeID, regionID);
160 }
150 161
151 public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) 162 public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
152 { 163 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 9519e23..696225c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -42,6 +42,8 @@ using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Hypergrid; 43using OpenSim.Region.Framework.Scenes.Hypergrid;
44using OpenSim.Region.Framework.Scenes.Serialization; 44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Services.Interfaces;
46using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45 47
46namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion 48namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
47{ 49{
@@ -59,6 +61,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
59 61
60 protected RegionToRegionClient m_regionClient; 62 protected RegionToRegionClient m_regionClient;
61 63
64 protected IHyperlinkService m_hyperlinkService;
65
62 protected bool m_safemode; 66 protected bool m_safemode;
63 protected IPAddress m_thisIP; 67 protected IPAddress m_thisIP;
64 68
@@ -134,7 +138,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
134 m_localBackend = new LocalInterregionComms(); 138 m_localBackend = new LocalInterregionComms();
135 m_commsManager = scene.CommsManager; 139 m_commsManager = scene.CommsManager;
136 m_aScene = scene; 140 m_aScene = scene;
137 m_regionClient = new RegionToRegionClient(m_aScene); 141 m_hyperlinkService = m_aScene.RequestModuleInterface<IHyperlinkService>();
142 m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService);
138 m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); 143 m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName);
139 } 144 }
140 145
@@ -161,7 +166,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
161 // else do the remote thing 166 // else do the remote thing
162 if (!m_localBackend.IsLocalRegion(regionHandle)) 167 if (!m_localBackend.IsLocalRegion(regionHandle))
163 { 168 {
164 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 169 uint x = 0, y = 0;
170 Utils.LongToUInts(regionHandle, out x, out y);
171 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
165 if (regInfo != null) 172 if (regInfo != null)
166 { 173 {
167 m_regionClient.SendUserInformation(regInfo, aCircuit); 174 m_regionClient.SendUserInformation(regInfo, aCircuit);
@@ -183,7 +190,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
183 // else do the remote thing 190 // else do the remote thing
184 if (!m_localBackend.IsLocalRegion(regionHandle)) 191 if (!m_localBackend.IsLocalRegion(regionHandle))
185 { 192 {
186 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 193 uint x = 0, y = 0;
194 Utils.LongToUInts(regionHandle, out x, out y);
195 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
187 if (regInfo != null) 196 if (regInfo != null)
188 { 197 {
189 return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); 198 return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
@@ -204,7 +213,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
204 // else do the remote thing 213 // else do the remote thing
205 if (!m_localBackend.IsLocalRegion(regionHandle)) 214 if (!m_localBackend.IsLocalRegion(regionHandle))
206 { 215 {
207 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 216 uint x = 0, y = 0;
217 Utils.LongToUInts(regionHandle, out x, out y);
218 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
208 if (regInfo != null) 219 if (regInfo != null)
209 { 220 {
210 return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); 221 return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
@@ -225,7 +236,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
225 // else do the remote thing 236 // else do the remote thing
226 if (!m_localBackend.IsLocalRegion(regionHandle)) 237 if (!m_localBackend.IsLocalRegion(regionHandle))
227 { 238 {
228 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 239 uint x = 0, y = 0;
240 Utils.LongToUInts(regionHandle, out x, out y);
241 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
229 if (regInfo != null) 242 if (regInfo != null)
230 { 243 {
231 return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent); 244 return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent);
@@ -257,7 +270,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
257 // else do the remote thing 270 // else do the remote thing
258 if (!m_localBackend.IsLocalRegion(regionHandle)) 271 if (!m_localBackend.IsLocalRegion(regionHandle))
259 { 272 {
260 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 273 uint x = 0, y = 0;
274 Utils.LongToUInts(regionHandle, out x, out y);
275 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
261 if (regInfo != null) 276 if (regInfo != null)
262 { 277 {
263 return m_regionClient.DoCloseAgentCall(regInfo, id); 278 return m_regionClient.DoCloseAgentCall(regInfo, id);
@@ -284,7 +299,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
284 // else do the remote thing 299 // else do the remote thing
285 if (!m_localBackend.IsLocalRegion(regionHandle)) 300 if (!m_localBackend.IsLocalRegion(regionHandle))
286 { 301 {
287 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 302 uint x = 0, y = 0;
303 Utils.LongToUInts(regionHandle, out x, out y);
304 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
288 if (regInfo != null) 305 if (regInfo != null)
289 { 306 {
290 return m_regionClient.DoCreateObjectCall( 307 return m_regionClient.DoCreateObjectCall(
@@ -776,16 +793,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
776 protected class RegionToRegionClient : RegionClient 793 protected class RegionToRegionClient : RegionClient
777 { 794 {
778 Scene m_aScene = null; 795 Scene m_aScene = null;
796 IHyperlinkService m_hyperlinkService;
779 797
780 public RegionToRegionClient(Scene s) 798 public RegionToRegionClient(Scene s, IHyperlinkService hyperService)
781 { 799 {
782 m_aScene = s; 800 m_aScene = s;
801 m_hyperlinkService = hyperService;
783 } 802 }
784 803
785 public override ulong GetRegionHandle(ulong handle) 804 public override ulong GetRegionHandle(ulong handle)
786 { 805 {
787 if (m_aScene.SceneGridService is HGSceneCommunicationService) 806 if (m_aScene.SceneGridService is HGSceneCommunicationService)
788 return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(handle); 807 {
808 if (m_hyperlinkService != null)
809 return m_hyperlinkService.FindRegionHandle(handle);
810 }
789 811
790 return handle; 812 return handle;
791 } 813 }
@@ -793,29 +815,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
793 public override bool IsHyperlink(ulong handle) 815 public override bool IsHyperlink(ulong handle)
794 { 816 {
795 if (m_aScene.SceneGridService is HGSceneCommunicationService) 817 if (m_aScene.SceneGridService is HGSceneCommunicationService)
796 return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.IsHyperlinkRegion(handle); 818 {
797 819 if ((m_hyperlinkService != null) && (m_hyperlinkService.GetHyperlinkRegion(handle) != null))
820 return true;
821 }
798 return false; 822 return false;
799 } 823 }
800 824
801 public override void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) 825 public override void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit)
802 { 826 {
803 try 827 if (m_hyperlinkService != null)
804 { 828 m_hyperlinkService.SendUserInformation(regInfo, aCircuit);
805 if (m_aScene.SceneGridService is HGSceneCommunicationService)
806 {
807 ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(regInfo, aCircuit);
808 }
809 }
810 catch // Bad cast
811 { }
812 829
813 } 830 }
814 831
815 public override void AdjustUserInformation(AgentCircuitData aCircuit) 832 public override void AdjustUserInformation(AgentCircuitData aCircuit)
816 { 833 {
817 if (m_aScene.SceneGridService is HGSceneCommunicationService) 834 if (m_hyperlinkService != null)
818 ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.AdjustUserInformation(aCircuit); 835 m_hyperlinkService.AdjustUserInformation(aCircuit);
819 } 836 }
820 } 837 }
821 838
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 1c66254..fd1a759 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -525,7 +525,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
525 return true; 525 return true;
526 } 526 }
527 527
528 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 528 if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == ""))
529 // this happens in standalone profiles, apparently
530 return true;
531
532 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
533
529 string uri = m_LocalGridInventoryURI.TrimEnd('/'); 534 string uri = m_LocalGridInventoryURI.TrimEnd('/');
530 535
531 if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) 536 if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
@@ -544,7 +549,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
544 if ((uinfo == null) || (uinfo.UserProfile == null)) 549 if ((uinfo == null) || (uinfo.UserProfile == null))
545 return invURI; 550 return invURI;
546 551
547 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 552 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
548 553
549 if ((userInventoryServerURI != null) && 554 if ((userInventoryServerURI != null) &&
550 (userInventoryServerURI != "")) 555 (userInventoryServerURI != ""))
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs
index a52c70b..b0ace39 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using OpenSim.Server.Base; 38using OpenSim.Server.Base;
39 39
40
40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land 41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
41{ 42{
42 public class RemoteLandServicesConnector : 43 public class RemoteLandServicesConnector :
@@ -89,7 +90,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
89 if (!m_Enabled) 90 if (!m_Enabled)
90 return; 91 return;
91 92
92 m_MapService = scene.CommsManager.GridService; 93 m_GridService = scene.GridService;
93 m_LocalService.AddRegion(scene); 94 m_LocalService.AddRegion(scene);
94 scene.RegisterModuleInterface<ILandService>(this); 95 scene.RegisterModuleInterface<ILandService>(this);
95 } 96 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
index 61bf481..daba0b3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
119 119
120 #region INeighbourService 120 #region INeighbourService
121 121
122 public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 122 public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
123 { 123 {
124 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", 124 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
125 thisRegion.RegionName, regionHandle, m_Scenes.Count); 125 thisRegion.RegionName, regionHandle, m_Scenes.Count);
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
132 } 132 }
133 } 133 }
134 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); 134 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle);
135 return false; 135 return null;
136 } 136 }
137 137
138 #endregion INeighbourService 138 #endregion INeighbourService
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs
index c5bc03b..c6fc2a1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs
@@ -118,7 +118,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
118 if (!m_Enabled) 118 if (!m_Enabled)
119 return; 119 return;
120 120
121 m_MapService = scene.CommsManager.GridService;
122 m_LocalService.AddRegion(scene); 121 m_LocalService.AddRegion(scene);
123 scene.RegisterModuleInterface<INeighbourService>(this); 122 scene.RegisterModuleInterface<INeighbourService>(this);
124 } 123 }
@@ -134,16 +133,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
134 if (!m_Enabled) 133 if (!m_Enabled)
135 return; 134 return;
136 135
136 m_GridService = scene.GridService;
137
137 m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName); 138 m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName);
138 139
139 } 140 }
140 141
141 #region INeighbourService 142 #region INeighbourService
142 143
143 public override bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 144 public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
144 { 145 {
145 if (m_LocalService.HelloNeighbour(regionHandle, thisRegion)) 146 GridRegion region = m_LocalService.HelloNeighbour(regionHandle, thisRegion);
146 return true; 147 if (region != null)
148 return region;
147 149
148 return base.HelloNeighbour(regionHandle, thisRegion); 150 return base.HelloNeighbour(regionHandle, thisRegion);
149 } 151 }