aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2009-09-27 10:14:10 -0700
committerDiva Canto2009-09-27 10:14:10 -0700
commit5d09c53a1a42b38e1ee35cfbb5571d70b75380f4 (patch)
tree247412b0147ea11f4113413c1fa7d7e91eec0aa5 /OpenSim
parentPoof! on LocalBackend. CommsManager.GridServices deleted. (diff)
downloadopensim-SC_OLD-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.zip
opensim-SC_OLD-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.tar.gz
opensim-SC_OLD-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.tar.bz2
opensim-SC_OLD-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.tar.xz
Unpacking the mess with OtherRegionUp, so we can have a real cache of the neighbours in the grid service modules.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IRegionCommsListener.cs3
-rw-r--r--OpenSim/Framework/IScene.cs2
-rw-r--r--OpenSim/Framework/RegionCommsListener.cs13
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs63
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs87
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs3
-rw-r--r--OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs10
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs6
-rw-r--r--OpenSim/Services/Interfaces/INeighbourService.cs3
15 files changed, 97 insertions, 127 deletions
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index ba4c616..307c6bc 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -46,8 +46,6 @@ namespace OpenSim.Framework
46 46
47 public delegate bool CloseAgentConnection(UUID agentID); 47 public delegate bool CloseAgentConnection(UUID agentID);
48 48
49 public delegate bool RegionUp(RegionInfo region);
50
51 public delegate bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData); 49 public delegate bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData);
52 50
53 public delegate void LogOffUser(UUID agentID, UUID regionSecret, string message); 51 public delegate void LogOffUser(UUID agentID, UUID regionSecret, string message);
@@ -65,7 +63,6 @@ namespace OpenSim.Framework
65 event AcknowledgePrimCross OnAcknowledgePrimCrossed; 63 event AcknowledgePrimCross OnAcknowledgePrimCrossed;
66 event UpdateNeighbours OnNeighboursUpdate; 64 event UpdateNeighbours OnNeighboursUpdate;
67 event CloseAgentConnection OnCloseAgentConnection; 65 event CloseAgentConnection OnCloseAgentConnection;
68 event RegionUp OnRegionUp;
69 event ChildAgentUpdate OnChildAgentUpdate; 66 event ChildAgentUpdate OnChildAgentUpdate;
70 event LogOffUser OnLogOffUser; 67 event LogOffUser OnLogOffUser;
71 event GetLandData OnGetLandData; 68 event GetLandData OnGetLandData;
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 2e2c703..d61e08c 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Framework
74 void CloseAllAgents(uint circuitcode); 74 void CloseAllAgents(uint circuitcode);
75 75
76 void Restart(int seconds); 76 void Restart(int seconds);
77 bool OtherRegionUp(RegionInfo thisRegion); 77 //RegionInfo OtherRegionUp(RegionInfo thisRegion);
78 78
79 string GetSimulatorVersion(); 79 string GetSimulatorVersion();
80 80
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index 016c78c..90200d6 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -47,7 +47,6 @@ namespace OpenSim.Framework
47 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser 47 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
48 private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; 48 private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
49 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; 49 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
50 private RegionUp handlerRegionUp = null; // OnRegionUp;
51 private LogOffUser handlerLogOffUser = null; 50 private LogOffUser handlerLogOffUser = null;
52 private GetLandData handlerGetLandData = null; 51 private GetLandData handlerGetLandData = null;
53 52
@@ -62,7 +61,6 @@ namespace OpenSim.Framework
62 public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; 61 public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
63 public event AcknowledgePrimCross OnAcknowledgePrimCrossed; 62 public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
64 public event CloseAgentConnection OnCloseAgentConnection; 63 public event CloseAgentConnection OnCloseAgentConnection;
65 public event RegionUp OnRegionUp;
66 public event ChildAgentUpdate OnChildAgentUpdate; 64 public event ChildAgentUpdate OnChildAgentUpdate;
67 public event LogOffUser OnLogOffUser; 65 public event LogOffUser OnLogOffUser;
68 public event GetLandData OnGetLandData; 66 public event GetLandData OnGetLandData;
@@ -108,17 +106,6 @@ namespace OpenSim.Framework
108 return false; 106 return false;
109 } 107 }
110 108
111 public virtual bool TriggerRegionUp(RegionInfo region)
112 {
113 handlerRegionUp = OnRegionUp;
114 if (handlerRegionUp != null)
115 {
116 handlerRegionUp(region);
117 return true;
118 }
119 return false;
120 }
121
122 public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData) 109 public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
123 { 110 {
124 handlerChildAgentUpdate = OnChildAgentUpdate; 111 handlerChildAgentUpdate = OnChildAgentUpdate;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
index c831f68..34c21aa 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
@@ -28,6 +28,7 @@
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Region.Framework.Scenes; 30using OpenSim.Region.Framework.Scenes;
31using GridRegion = OpenSim.Services.Interfaces.GridRegion;
31 32
32namespace OpenSim.Region.ClientStack.LindenUDP.Tests 33namespace OpenSim.Region.ClientStack.LindenUDP.Tests
33{ 34{
@@ -58,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
58 59
59 public override void RemoveClient(UUID agentID) {} 60 public override void RemoveClient(UUID agentID) {}
60 public override void CloseAllAgents(uint circuitcode) {} 61 public override void CloseAllAgents(uint circuitcode) {}
61 public override bool OtherRegionUp(RegionInfo thisRegion) { return false; } 62 public override void OtherRegionUp(GridRegion otherRegion) { }
62 63
63 /// <summary> 64 /// <summary>
64 /// Doesn't really matter what the call is - we're using this to test that a packet has actually been received 65 /// Doesn't really matter what the call is - we're using this to test that a packet has actually been received
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
index a31ce8e..8a90370 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
121 121
122 #region INeighbourService 122 #region INeighbourService
123 123
124 public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 124 public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
125 { 125 {
126 m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", 126 m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
127 thisRegion.RegionName, regionHandle, m_Scenes.Count); 127 thisRegion.RegionName, regionHandle, m_Scenes.Count);
@@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
134 } 134 }
135 } 135 }
136 m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle); 136 m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle);
137 return false; 137 return null;
138 } 138 }
139 139
140 #endregion INeighbourService 140 #endregion INeighbourService
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 912c393..c6fc2a1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs
@@ -141,10 +141,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
141 141
142 #region INeighbourService 142 #region INeighbourService
143 143
144 public override bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 144 public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
145 { 145 {
146 if (m_LocalService.HelloNeighbour(regionHandle, thisRegion)) 146 GridRegion region = m_LocalService.HelloNeighbour(regionHandle, thisRegion);
147 return true; 147 if (region != null)
148 return region;
148 149
149 return base.HelloNeighbour(regionHandle, thisRegion); 150 return base.HelloNeighbour(regionHandle, thisRegion);
150 } 151 }
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 287d8d9..7424b24 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -32,6 +32,7 @@ using OpenSim.Framework;
32using OpenSim.Framework.Client; 32using OpenSim.Framework.Client;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using Caps=OpenSim.Framework.Capabilities.Caps; 34using Caps=OpenSim.Framework.Capabilities.Caps;
35using GridRegion = OpenSim.Services.Interfaces.GridRegion;
35 36
36namespace OpenSim.Region.Framework.Scenes 37namespace OpenSim.Region.Framework.Scenes
37{ 38{
@@ -305,6 +306,9 @@ namespace OpenSim.Region.Framework.Scenes
305 public delegate void Attach(uint localID, UUID itemID, UUID avatarID); 306 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
306 public event Attach OnAttach; 307 public event Attach OnAttach;
307 308
309 public delegate void RegionUp(GridRegion region);
310 public event RegionUp OnRegionUp;
311
308 public class MoneyTransferArgs : EventArgs 312 public class MoneyTransferArgs : EventArgs
309 { 313 {
310 public UUID sender; 314 public UUID sender;
@@ -446,6 +450,7 @@ namespace OpenSim.Region.Framework.Scenes
446 private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null; 450 private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
447 451
448 private Attach handlerOnAttach = null; 452 private Attach handlerOnAttach = null;
453 private RegionUp handlerOnRegionUp = null;
449 454
450 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) 455 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
451 { 456 {
@@ -1035,5 +1040,13 @@ namespace OpenSim.Region.Framework.Scenes
1035 if (handlerSetRootAgentScene != null) 1040 if (handlerSetRootAgentScene != null)
1036 handlerSetRootAgentScene(agentID, scene); 1041 handlerSetRootAgentScene(agentID, scene);
1037 } 1042 }
1043
1044 public void TriggerOnRegionUp(GridRegion otherRegion)
1045 {
1046 handlerOnRegionUp = OnRegionUp;
1047 if (handlerOnRegionUp != null)
1048 handlerOnRegionUp(otherRegion);
1049 }
1050
1038 } 1051 }
1039} 1052}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8990f29..55478da 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -587,10 +587,7 @@ namespace OpenSim.Region.Framework.Scenes
587 } 587 }
588 588
589 /// <summary> 589 /// <summary>
590 /// Another region is up. Gets called from Grid Comms: 590 /// Another region is up.
591 /// (OGS1 -> LocalBackEnd -> RegionListened -> SceneCommunicationService)
592 /// We have to tell all our ScenePresences about it, and add it to the
593 /// neighbor list.
594 /// 591 ///
595 /// We only add it to the neighbor list if it's within 1 region from here. 592 /// We only add it to the neighbor list if it's within 1 region from here.
596 /// Agents may have draw distance values that cross two regions though, so 593 /// Agents may have draw distance values that cross two regions though, so
@@ -599,47 +596,27 @@ namespace OpenSim.Region.Framework.Scenes
599 /// </summary> 596 /// </summary>
600 /// <param name="otherRegion">RegionInfo handle for the new region.</param> 597 /// <param name="otherRegion">RegionInfo handle for the new region.</param>
601 /// <returns>True after all operations complete, throws exceptions otherwise.</returns> 598 /// <returns>True after all operations complete, throws exceptions otherwise.</returns>
602 public override bool OtherRegionUp(RegionInfo otherRegion) 599 public override void OtherRegionUp(GridRegion otherRegion)
603 { 600 {
604 m_log.InfoFormat("[SCENE]: Region {0} up in coords {1}-{2}", otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); 601 uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
602 uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
603 m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
604 RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell);
605 605
606 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 606 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
607 { 607 {
608 for (int i = 0; i < m_neighbours.Count; i++)
609 {
610 // The purpose of this loop is to re-update the known neighbors
611 // when another region comes up on top of another one.
612 // The latest region in that location ends up in the
613 // 'known neighbors list'
614 // Additionally, the commFailTF property gets reset to false.
615 if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle)
616 {
617 lock (m_neighbours)
618 {
619 m_neighbours[i] = otherRegion;
620
621 }
622 }
623 }
624
625 // If the value isn't in the neighbours, add it.
626 // If the RegionInfo isn't exact but is for the same XY World location,
627 // then the above loop will fix that.
628
629 if (!(CheckNeighborRegion(otherRegion)))
630 {
631 lock (m_neighbours)
632 {
633 m_neighbours.Add(otherRegion);
634 //m_log.Info("[UP]: " + otherRegion.RegionHandle.ToString());
635 }
636 }
637 608
638 // If these are cast to INT because long + negative values + abs returns invalid data 609 // If these are cast to INT because long + negative values + abs returns invalid data
639 int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX); 610 int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
640 int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY); 611 int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
641 if (resultX <= 1 && resultY <= 1) 612 if (resultX <= 1 && resultY <= 1)
642 { 613 {
614 RegionInfo regInfo = new RegionInfo(xcell, ycell, otherRegion.InternalEndPoint, otherRegion.ExternalHostName);
615 regInfo.RegionID = otherRegion.RegionID;
616 regInfo.RegionName = otherRegion.RegionName;
617 regInfo.ScopeID = otherRegion.ScopeID;
618 regInfo.ExternalHostName = otherRegion.ExternalHostName;
619
643 try 620 try
644 { 621 {
645 ForEachScenePresence(delegate(ScenePresence agent) 622 ForEachScenePresence(delegate(ScenePresence agent)
@@ -653,7 +630,7 @@ namespace OpenSim.Region.Framework.Scenes
653 List<ulong> old = new List<ulong>(); 630 List<ulong> old = new List<ulong>();
654 old.Add(otherRegion.RegionHandle); 631 old.Add(otherRegion.RegionHandle);
655 agent.DropOldNeighbours(old); 632 agent.DropOldNeighbours(old);
656 InformClientOfNeighbor(agent, otherRegion); 633 InformClientOfNeighbor(agent, regInfo);
657 } 634 }
658 } 635 }
659 ); 636 );
@@ -672,7 +649,6 @@ namespace OpenSim.Region.Framework.Scenes
672 otherRegion.RegionLocY.ToString() + ")"); 649 otherRegion.RegionLocY.ToString() + ")");
673 } 650 }
674 } 651 }
675 return true;
676 } 652 }
677 653
678 public void AddNeighborRegion(RegionInfo region) 654 public void AddNeighborRegion(RegionInfo region)
@@ -704,9 +680,10 @@ namespace OpenSim.Region.Framework.Scenes
704 } 680 }
705 681
706 // Alias IncomingHelloNeighbour OtherRegionUp, for now 682 // Alias IncomingHelloNeighbour OtherRegionUp, for now
707 public bool IncomingHelloNeighbour(RegionInfo neighbour) 683 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
708 { 684 {
709 return OtherRegionUp(neighbour); 685 OtherRegionUp(new GridRegion(neighbour));
686 return new GridRegion(RegionInfo);
710 } 687 }
711 688
712 /// <summary> 689 /// <summary>
@@ -3104,7 +3081,7 @@ namespace OpenSim.Region.Framework.Scenes
3104 m_sceneGridService.OnExpectUser += HandleNewUserConnection; 3081 m_sceneGridService.OnExpectUser += HandleNewUserConnection;
3105 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 3082 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
3106 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; 3083 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
3107 m_sceneGridService.OnRegionUp += OtherRegionUp; 3084 //m_eventManager.OnRegionUp += OtherRegionUp;
3108 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 3085 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3109 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; 3086 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
3110 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 3087 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
@@ -3132,7 +3109,7 @@ namespace OpenSim.Region.Framework.Scenes
3132 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; 3109 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
3133 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; 3110 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
3134 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 3111 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3135 m_sceneGridService.OnRegionUp -= OtherRegionUp; 3112 //m_eventManager.OnRegionUp -= OtherRegionUp;
3136 m_sceneGridService.OnExpectUser -= HandleNewUserConnection; 3113 m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
3137 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 3114 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
3138 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; 3115 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 2a82237..2af98cc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework;
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Communications.Cache; 37using OpenSim.Framework.Communications.Cache;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39 40
40namespace OpenSim.Region.Framework.Scenes 41namespace OpenSim.Region.Framework.Scenes
41{ 42{
@@ -227,7 +228,7 @@ namespace OpenSim.Region.Framework.Scenes
227 return false; 228 return false;
228 } 229 }
229 230
230 public abstract bool OtherRegionUp(RegionInfo thisRegion); 231 public abstract void OtherRegionUp(GridRegion otherRegion);
231 232
232 public virtual string GetSimulatorVersion() 233 public virtual string GetSimulatorVersion()
233 { 234 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 9071701..3294ceb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -93,10 +93,10 @@ namespace OpenSim.Region.Framework.Scenes
93 /// </summary> 93 /// </summary>
94 public event PrimCrossing OnPrimCrossingIntoRegion; 94 public event PrimCrossing OnPrimCrossingIntoRegion;
95 95
96 /// <summary> 96 ///// <summary>
97 /// A New Region is up and available 97 ///// A New Region is up and available
98 /// </summary> 98 ///// </summary>
99 public event RegionUp OnRegionUp; 99 //public event RegionUp OnRegionUp;
100 100
101 /// <summary> 101 /// <summary>
102 /// We have a child agent for this avatar and we're getting a status update about it 102 /// We have a child agent for this avatar and we're getting a status update about it
@@ -119,7 +119,7 @@ namespace OpenSim.Region.Framework.Scenes
119 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; 119 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
120 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; 120 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
121 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; 121 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
122 private RegionUp handlerRegionUp = null; // OnRegionUp; 122 //private RegionUp handlerRegionUp = null; // OnRegionUp;
123 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; 123 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
124 //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; 124 //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
125 private LogOffUser handlerLogOffUser = null; 125 private LogOffUser handlerLogOffUser = null;
@@ -239,22 +239,6 @@ namespace OpenSim.Region.Framework.Scenes
239 } 239 }
240 240
241 /// <summary> 241 /// <summary>
242 /// A New Region is now available. Inform the scene that there is a new region available.
243 /// </summary>
244 /// <param name="region">Information about the new region that is available</param>
245 /// <returns>True if the event was handled</returns>
246 protected bool newRegionUp(RegionInfo region)
247 {
248 handlerRegionUp = OnRegionUp;
249 if (handlerRegionUp != null)
250 {
251 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
252 handlerRegionUp(region);
253 }
254 return true;
255 }
256
257 /// <summary>
258 /// Inform the scene that we've got an update about a child agent that we have 242 /// Inform the scene that we've got an update about a child agent that we have
259 /// </summary> 243 /// </summary>
260 /// <param name="cAgentData"></param> 244 /// <param name="cAgentData"></param>
@@ -647,31 +631,23 @@ namespace OpenSim.Region.Framework.Scenes
647 /// <param name="regionhandle"></param> 631 /// <param name="regionhandle"></param>
648 private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle) 632 private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
649 { 633 {
650 m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here"); 634 uint x = 0, y = 0;
651 //RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); 635 Utils.LongToUInts(regionhandle, out x, out y);
652 636
653 //bool regionAccepted = 637 GridRegion neighbour = null;
654 // m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region), regionhandle);
655
656 //bool regionAccepted = m_interregionCommsOut.SendHelloNeighbour(regionhandle, region);
657 bool regionAccepted = false;
658 if (neighbourService != null) 638 if (neighbourService != null)
659 regionAccepted = neighbourService.HelloNeighbour(regionhandle, region); 639 neighbour = neighbourService.HelloNeighbour(regionhandle, region);
660 else 640 else
661 m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region"); 641 m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region");
662 642
663 if (regionAccepted) 643 if (neighbour != null)
664 { 644 {
665 m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here"); 645 m_log.DebugFormat("[INTERGRID]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize);
666 handlerRegionUp = OnRegionUp; 646 m_scene.EventManager.TriggerOnRegionUp(neighbour);
667
668 // yes, we're notifying ourselves.
669 if (handlerRegionUp != null)
670 handlerRegionUp(region);
671 } 647 }
672 else 648 else
673 { 649 {
674 m_log.Warn("[INTERGRID]: Failed to inform neighbors that I'm here."); 650 m_log.WarnFormat("[INTERGRID]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize);
675 } 651 }
676 } 652 }
677 653
@@ -680,22 +656,33 @@ namespace OpenSim.Region.Framework.Scenes
680 { 656 {
681 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); 657 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
682 658
659 for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
660 for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
661 if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
662 {
663 ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
664 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
683 665
684 List<GridRegion> neighbours = new List<GridRegion>(); 666 d.BeginInvoke(neighbourService, region, handle,
685 // This stays uncached because we don't already know about our neighbors at this point. 667 InformNeighborsThatRegionisUpCompleted,
668 d);
669 }
686 670
687 neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); 671 //List<GridRegion> neighbours = new List<GridRegion>();
688 if (neighbours != null) 672 //// This stays uncached because we don't already know about our neighbors at this point.
689 {
690 for (int i = 0; i < neighbours.Count; i++)
691 {
692 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
693 673
694 d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle, 674 //neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
695 InformNeighborsThatRegionisUpCompleted, 675 //if (neighbours != null)
696 d); 676 //{
697 } 677 // for (int i = 0; i < neighbours.Count; i++)
698 } 678 // {
679 // InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
680
681 // d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
682 // InformNeighborsThatRegionisUpCompleted,
683 // d);
684 // }
685 //}
699 686
700 //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region)); 687 //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
701 } 688 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
index f6737a5..5c9e66f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
@@ -29,6 +29,7 @@ using System;
29using NUnit.Framework; 29using NUnit.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using GridRegion = OpenSim.Services.Interfaces.GridRegion;
32 33
33namespace OpenSim.Region.Framework.Scenes.Tests 34namespace OpenSim.Region.Framework.Scenes.Tests
34{ 35{
@@ -65,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
65 throw new NotImplementedException(); 66 throw new NotImplementedException();
66 } 67 }
67 68
68 public override bool OtherRegionUp(RegionInfo thisRegion) 69 public override void OtherRegionUp(GridRegion otherRegion)
69 { 70 {
70 throw new NotImplementedException(); 71 throw new NotImplementedException();
71 } 72 }
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
index c0933a8..d6ef22e 100644
--- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
+++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
@@ -36,6 +36,7 @@ using OpenSim.Server.Handlers.Base;
36using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39 40
40using OpenMetaverse; 41using OpenMetaverse;
41using OpenMetaverse.StructuredData; 42using OpenMetaverse.StructuredData;
@@ -148,11 +149,14 @@ namespace OpenSim.Server.Handlers.Neighbour
148 } 149 }
149 150
150 // Finally! 151 // Finally!
151 bool success = m_NeighbourService.HelloNeighbour(regionhandle, aRegion); 152 GridRegion thisRegion = m_NeighbourService.HelloNeighbour(regionhandle, aRegion);
152 153
153 OSDMap resp = new OSDMap(1); 154 OSDMap resp = new OSDMap(1);
154 155
155 resp["success"] = OSD.FromBoolean(success); 156 if (thisRegion != null)
157 resp["success"] = OSD.FromBoolean(true);
158 else
159 resp["success"] = OSD.FromBoolean(false);
156 160
157 httpResponse.StatusCode = (int)HttpStatusCode.OK; 161 httpResponse.StatusCode = (int)HttpStatusCode.OK;
158 162
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
index 1b595e7..145f212 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Services.Connectors
67 m_GridService = gridServices; 67 m_GridService = gridServices;
68 } 68 }
69 69
70 public virtual bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 70 public virtual GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
71 { 71 {
72 uint x = 0, y = 0; 72 uint x = 0, y = 0;
73 Utils.LongToUInts(regionHandle, out x, out y); 73 Utils.LongToUInts(regionHandle, out x, out y);
@@ -76,11 +76,11 @@ namespace OpenSim.Services.Connectors
76 // Don't remote-call this instance; that's a startup hickup 76 // Don't remote-call this instance; that's a startup hickup
77 !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) 77 !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort)))
78 { 78 {
79 return DoHelloNeighbourCall(regInfo, thisRegion); 79 DoHelloNeighbourCall(regInfo, thisRegion);
80 } 80 }
81 //else 81 //else
82 // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); 82 // m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
83 return false; 83 return regInfo;
84 } 84 }
85 85
86 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) 86 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
diff --git a/OpenSim/Services/Interfaces/INeighbourService.cs b/OpenSim/Services/Interfaces/INeighbourService.cs
index 3944486..960e13d 100644
--- a/OpenSim/Services/Interfaces/INeighbourService.cs
+++ b/OpenSim/Services/Interfaces/INeighbourService.cs
@@ -28,11 +28,12 @@
28using System; 28using System;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31using GridRegion = OpenSim.Services.Interfaces.GridRegion;
31 32
32namespace OpenSim.Services.Interfaces 33namespace OpenSim.Services.Interfaces
33{ 34{
34 public interface INeighbourService 35 public interface INeighbourService
35 { 36 {
36 bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion); 37 GridRegion HelloNeighbour(ulong regionHandle, RegionInfo otherRegion);
37 } 38 }
38} 39}