aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs41
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs33
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs22
4 files changed, 77 insertions, 22 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index fd17d56..a9791ee 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Scenes
216 m_regionHandle = m_regInfo.RegionHandle; 216 m_regionHandle = m_regInfo.RegionHandle;
217 m_regionName = m_regInfo.RegionName; 217 m_regionName = m_regInfo.RegionName;
218 m_datastore = m_regInfo.DataStore; 218 m_datastore = m_regInfo.DataStore;
219 RegisterRegionWithComms(); 219
220 m_physicalPrim = physicalPrim; 220 m_physicalPrim = physicalPrim;
221 m_sendTasksToChild = SendTasksToChild; 221 m_sendTasksToChild = SendTasksToChild;
222 222
@@ -244,6 +244,7 @@ namespace OpenSim.Region.Environment.Scenes
244 244
245 httpListener = httpServer; 245 httpListener = httpServer;
246 m_dumpAssetsToFile = dumpAssetsToFile; 246 m_dumpAssetsToFile = dumpAssetsToFile;
247 RegisterRegionWithComms();
247 } 248 }
248 249
249 #endregion 250 #endregion
@@ -257,21 +258,29 @@ namespace OpenSim.Region.Environment.Scenes
257 m_eventManager.OnPermissionError += SendPermissionAlert; 258 m_eventManager.OnPermissionError += SendPermissionAlert;
258 } 259 }
259 260
260 public override void OtherRegionUp(RegionInfo otherRegion) 261 public override bool OtherRegionUp(RegionInfo otherRegion)
261 { 262 {
262 // Another region is up. We have to tell all our ScenePresences about it 263 // Another region is up. We have to tell all our ScenePresences about it
263 // This fails to get the desired effect and needs further work. 264 // This fails to get the desired effect and needs further work.
264 265 try
265 ForEachScenePresence(delegate(ScenePresence agent)
266 { 266 {
267 if (!(agent.IsChildAgent)) 267
268 { 268 ForEachScenePresence(delegate(ScenePresence agent)
269 InformClientOfNeighbor(agent, otherRegion); 269 {
270 this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 270 if (!(agent.IsChildAgent))
271 271 {
272 this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
273 InformClientOfNeighbor(agent, otherRegion);
274 }
272 } 275 }
276
277 );
273 } 278 }
274 ); 279 catch (System.NullReferenceException)
280 {
281 // This means that we're not booted up completely yet.
282 }
283 return true;
275 } 284 }
276 public virtual void Restart(float seconds) 285 public virtual void Restart(float seconds)
277 { 286 {
@@ -1068,9 +1077,13 @@ namespace OpenSim.Region.Environment.Scenes
1068 m_sceneGridService.OnExpectUser += NewUserConnection; 1077 m_sceneGridService.OnExpectUser += NewUserConnection;
1069 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 1078 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
1070 m_sceneGridService.OnCloseAgentConnection += CloseConnection; 1079 m_sceneGridService.OnCloseAgentConnection += CloseConnection;
1080 m_sceneGridService.OnRegionUp += OtherRegionUp;
1081 // Tell Other regions that I'm here.
1082 m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo);
1071 } 1083 }
1072 public void UnRegisterReginWithComms() 1084 public void UnRegisterReginWithComms()
1073 { 1085 {
1086 m_sceneGridService.OnRegionUp -= OtherRegionUp;
1074 m_sceneGridService.OnExpectUser -= NewUserConnection; 1087 m_sceneGridService.OnExpectUser -= NewUserConnection;
1075 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 1088 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
1076 m_sceneGridService.OnCloseAgentConnection -= CloseConnection; 1089 m_sceneGridService.OnCloseAgentConnection -= CloseConnection;
@@ -1578,9 +1591,13 @@ namespace OpenSim.Region.Environment.Scenes
1578 /// <param name="action"></param> 1591 /// <param name="action"></param>
1579 public void ForEachScenePresence(Action<ScenePresence> action) 1592 public void ForEachScenePresence(Action<ScenePresence> action)
1580 { 1593 {
1581 foreach (ScenePresence presence in m_scenePresences.Values) 1594 // We don't want to try to send messages if there are no avatar.
1595 if (!(m_scenePresences.Equals(null)))
1582 { 1596 {
1583 action(presence); 1597 foreach (ScenePresence presence in m_scenePresences.Values)
1598 {
1599 action(presence);
1600 }
1584 } 1601 }
1585 } 1602 }
1586 1603
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 4359374..2db3bdc 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -41,7 +41,6 @@ namespace OpenSim.Region.Environment.Scenes
41 #region Events 41 #region Events
42 42
43 public event restart OnRestart; 43 public event restart OnRestart;
44 public event regionup OnRegionUp;
45 44
46 #endregion 45 #endregion
47 46
@@ -160,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
160 } 159 }
161 160
162 161
163 public abstract void OtherRegionUp(RegionInfo thisRegion); 162 public abstract bool OtherRegionUp(RegionInfo thisRegion);
164 163
165 164
166 #endregion 165 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 9a10c51..ae44acb 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -21,6 +21,7 @@ namespace OpenSim.Region.Environment.Scenes
21 public event ExpectUserDelegate OnExpectUser; 21 public event ExpectUserDelegate OnExpectUser;
22 public event CloseAgentConnection OnCloseAgentConnection; 22 public event CloseAgentConnection OnCloseAgentConnection;
23 public event PrimCrossing OnPrimCrossingIntoRegion; 23 public event PrimCrossing OnPrimCrossingIntoRegion;
24 public event RegionUp OnRegionUp;
24 25
25 26
26 public SceneCommunicationService(CommunicationsManager commsMan) 27 public SceneCommunicationService(CommunicationsManager commsMan)
@@ -38,6 +39,7 @@ namespace OpenSim.Region.Environment.Scenes
38 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; 39 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
39 regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing; 40 regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing;
40 regionCommsHost.OnCloseAgentConnection += CloseConnection; 41 regionCommsHost.OnCloseAgentConnection += CloseConnection;
42 regionCommsHost.OnRegionUp += newRegionUp;
41 43
42 44
43 } 45 }
@@ -45,12 +47,16 @@ namespace OpenSim.Region.Environment.Scenes
45 47
46 public void Close() 48 public void Close()
47 { 49 {
48 regionCommsHost.OnExpectUser -= NewUserConnection; 50 if (regionCommsHost != null)
49 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; 51 {
50 regionCommsHost.OnPrimCrossingIntoRegion -= PrimCrossing; 52 regionCommsHost.OnRegionUp -= newRegionUp;
51 regionCommsHost.OnCloseAgentConnection -= CloseConnection; 53 regionCommsHost.OnExpectUser -= NewUserConnection;
52 m_commsProvider.GridService.DeregisterRegion(m_regionInfo); 54 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
53 regionCommsHost = null; 55 regionCommsHost.OnPrimCrossingIntoRegion -= PrimCrossing;
56 regionCommsHost.OnCloseAgentConnection -= CloseConnection;
57 m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
58 regionCommsHost = null;
59 }
54 } 60 }
55 61
56 #region CommsManager Event handlers 62 #region CommsManager Event handlers
@@ -59,6 +65,7 @@ namespace OpenSim.Region.Environment.Scenes
59 /// </summary> 65 /// </summary>
60 /// <param name="regionHandle"></param> 66 /// <param name="regionHandle"></param>
61 /// <param name="agent"></param> 67 /// <param name="agent"></param>
68 ///
62 protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent) 69 protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
63 { 70 {
64 if (OnExpectUser != null) 71 if (OnExpectUser != null)
@@ -67,6 +74,15 @@ namespace OpenSim.Region.Environment.Scenes
67 } 74 }
68 } 75 }
69 76
77 protected bool newRegionUp(RegionInfo region)
78 {
79 if (OnRegionUp != null)
80 {
81 OnRegionUp(region);
82 }
83 return true;
84 }
85
70 protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 86 protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
71 { 87 {
72 if (OnAvatarCrossingIntoRegion != null) 88 if (OnAvatarCrossingIntoRegion != null)
@@ -249,6 +265,11 @@ namespace OpenSim.Region.Environment.Scenes
249 return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); 265 return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
250 } 266 }
251 267
268 public void InformNeighborsThatRegionisUp(RegionInfo region)
269 {
270 bool val = m_commsProvider.InterRegion.RegionUp(region);
271 }
272
252 public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical) 273 public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical)
253 { 274 {
254 return m_commsProvider.InterRegion.ExpectPrimCrossing(regionhandle, primID, position, isPhysical); 275 return m_commsProvider.InterRegion.ExpectPrimCrossing(regionhandle, primID, position, isPhysical);
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 4360d97..c28269e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -121,17 +121,35 @@ namespace OpenSim.Region.Environment.Scenes
121 121
122 public void SendSimOnlineNotification(ulong regionHandle) 122 public void SendSimOnlineNotification(ulong regionHandle)
123 { 123 {
124 RegionInfo Result = null;
124 125
125 for (int i = 0; i < m_localScenes.Count; i++) 126 for (int i = 0; i < m_localScenes.Count; i++)
126 { 127 {
127 if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) 128
129 if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
128 { 130 {
131
129 // Inform other regions to tell their avatar about me 132 // Inform other regions to tell their avatar about me
130 m_localScenes[i].OtherRegionUp(m_localScenes[i].RegionInfo); 133 Result = m_localScenes[i].RegionInfo;
131 } 134 }
132 } 135 }
136 if (!(Result.Equals(null)))
137 {
138 for (int i = 0; i < m_localScenes.Count; i++)
139 {
133 140
141 if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle)
142 {
134 143
144 // Inform other regions to tell their avatar about me
145 //m_localScenes[i].OtherRegionUp(Result);
146 }
147 }
148 }
149 else
150 {
151 MainLog.Instance.Error("REGION", "Unable to notify Other regions of this Region coming up");
152 }
135 } 153 }
136 public void SaveCurrentSceneToXml(string filename) 154 public void SaveCurrentSceneToXml(string filename)
137 { 155 {