diff options
author | Robert Adams | 2013-05-03 14:25:52 -0700 |
---|---|---|
committer | Robert Adams | 2013-05-03 14:25:52 -0700 |
commit | 1ffa69f691449fb240327505c94b18d4bf63c103 (patch) | |
tree | d2c0c028badd4c491418845a56e9582c62dfacf2 /OpenSim | |
parent | BulletSim: zero vehicle motion when changing vehicle type. (diff) | |
parent | Fix possible race condition with local region cache if a region was added aft... (diff) | |
download | opensim-SC_OLD-1ffa69f691449fb240327505c94b18d4bf63c103.zip opensim-SC_OLD-1ffa69f691449fb240327505c94b18d4bf63c103.tar.gz opensim-SC_OLD-1ffa69f691449fb240327505c94b18d4bf63c103.tar.bz2 opensim-SC_OLD-1ffa69f691449fb240327505c94b18d4bf63c103.tar.xz |
Merge branch 'master' into bulletsim4
Diffstat (limited to 'OpenSim')
7 files changed, 69 insertions, 29 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index fcb6991..1d63d26 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -115,6 +115,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
115 | Environment.Exit(1); | 115 | Environment.Exit(1); |
116 | } | 116 | } |
117 | 117 | ||
118 | List<IScene> createdScenes = new List<IScene>(); | ||
119 | |||
118 | for (int i = 0; i < regionsToLoad.Length; i++) | 120 | for (int i = 0; i < regionsToLoad.Length; i++) |
119 | { | 121 | { |
120 | IScene scene; | 122 | IScene scene; |
@@ -123,17 +125,22 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
123 | ")"); | 125 | ")"); |
124 | 126 | ||
125 | bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]); | 127 | bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]); |
128 | |||
126 | m_openSim.CreateRegion(regionsToLoad[i], true, out scene); | 129 | m_openSim.CreateRegion(regionsToLoad[i], true, out scene); |
130 | createdScenes.Add(scene); | ||
131 | |||
127 | if (changed) | 132 | if (changed) |
128 | regionsToLoad[i].EstateSettings.Save(); | 133 | regionsToLoad[i].EstateSettings.Save(); |
129 | 134 | } | |
130 | if (scene != null) | 135 | |
136 | foreach (IScene scene in createdScenes) | ||
137 | { | ||
138 | scene.Start(); | ||
139 | |||
140 | m_newRegionCreatedHandler = OnNewRegionCreated; | ||
141 | if (m_newRegionCreatedHandler != null) | ||
131 | { | 142 | { |
132 | m_newRegionCreatedHandler = OnNewRegionCreated; | 143 | m_newRegionCreatedHandler(scene); |
133 | if (m_newRegionCreatedHandler != null) | ||
134 | { | ||
135 | m_newRegionCreatedHandler(scene); | ||
136 | } | ||
137 | } | 144 | } |
138 | } | 145 | } |
139 | } | 146 | } |
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index d19b8b6..355f7b3 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -700,6 +700,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
700 | 700 | ||
701 | IScene newScene; | 701 | IScene newScene; |
702 | m_application.CreateRegion(region, out newScene); | 702 | m_application.CreateRegion(region, out newScene); |
703 | newScene.Start(); | ||
703 | 704 | ||
704 | // If an access specification was provided, use it. | 705 | // If an access specification was provided, use it. |
705 | // Otherwise accept the default. | 706 | // Otherwise accept the default. |
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 87ec99e..8164f41 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs | |||
@@ -136,5 +136,10 @@ namespace OpenSim.Framework | |||
136 | ISceneObject DeserializeObject(string representation); | 136 | ISceneObject DeserializeObject(string representation); |
137 | 137 | ||
138 | bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); | 138 | bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); |
139 | |||
140 | /// <summary> | ||
141 | /// Start the scene and associated scripts within it. | ||
142 | /// </summary> | ||
143 | void Start(); | ||
139 | } | 144 | } |
140 | } | 145 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index d86eefe..f9e0cf1 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -425,9 +425,6 @@ namespace OpenSim | |||
425 | 425 | ||
426 | mscene = scene; | 426 | mscene = scene; |
427 | 427 | ||
428 | scene.Start(); | ||
429 | scene.StartScripts(); | ||
430 | |||
431 | return clientServers; | 428 | return clientServers; |
432 | } | 429 | } |
433 | 430 | ||
@@ -751,6 +748,7 @@ namespace OpenSim | |||
751 | ShutdownClientServer(whichRegion); | 748 | ShutdownClientServer(whichRegion); |
752 | IScene scene; | 749 | IScene scene; |
753 | CreateRegion(whichRegion, true, out scene); | 750 | CreateRegion(whichRegion, true, out scene); |
751 | scene.Start(); | ||
754 | } | 752 | } |
755 | 753 | ||
756 | # region Setup methods | 754 | # region Setup methods |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index c0c2ca7..c32820e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | |||
@@ -142,10 +142,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
142 | 142 | ||
143 | scene.RegisterModuleInterface<IGridService>(this); | 143 | scene.RegisterModuleInterface<IGridService>(this); |
144 | 144 | ||
145 | if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) | 145 | lock (m_LocalCache) |
146 | m_log.ErrorFormat("[LOCAL GRID SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); | 146 | { |
147 | else | 147 | if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) |
148 | m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); | 148 | m_log.ErrorFormat("[LOCAL GRID SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); |
149 | else | ||
150 | m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); | ||
151 | } | ||
149 | } | 152 | } |
150 | 153 | ||
151 | public void RemoveRegion(Scene scene) | 154 | public void RemoveRegion(Scene scene) |
@@ -153,8 +156,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
153 | if (!m_Enabled) | 156 | if (!m_Enabled) |
154 | return; | 157 | return; |
155 | 158 | ||
156 | m_LocalCache[scene.RegionInfo.RegionID].Clear(); | 159 | lock (m_LocalCache) |
157 | m_LocalCache.Remove(scene.RegionInfo.RegionID); | 160 | { |
161 | m_LocalCache[scene.RegionInfo.RegionID].Clear(); | ||
162 | m_LocalCache.Remove(scene.RegionInfo.RegionID); | ||
163 | } | ||
158 | } | 164 | } |
159 | 165 | ||
160 | public void RegionLoaded(Scene scene) | 166 | public void RegionLoaded(Scene scene) |
@@ -191,12 +197,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
191 | 197 | ||
192 | // First see if it's a neighbour, even if it isn't on this sim. | 198 | // First see if it's a neighbour, even if it isn't on this sim. |
193 | // Neighbour data is cached in memory, so this is fast | 199 | // Neighbour data is cached in memory, so this is fast |
194 | foreach (RegionCache rcache in m_LocalCache.Values) | 200 | |
201 | lock (m_LocalCache) | ||
195 | { | 202 | { |
196 | region = rcache.GetRegionByPosition(x, y); | 203 | foreach (RegionCache rcache in m_LocalCache.Values) |
197 | if (region != null) | ||
198 | { | 204 | { |
199 | return region; | 205 | region = rcache.GetRegionByPosition(x, y); |
206 | if (region != null) | ||
207 | { | ||
208 | return region; | ||
209 | } | ||
200 | } | 210 | } |
201 | } | 211 | } |
202 | 212 | ||
@@ -245,12 +255,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
245 | { | 255 | { |
246 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | 256 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); |
247 | 257 | ||
248 | foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache) | 258 | lock (m_LocalCache) |
249 | { | 259 | { |
250 | caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key); | 260 | foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache) |
251 | List<GridRegion> regions = kvp.Value.GetNeighbours(); | 261 | { |
252 | foreach (GridRegion r in regions) | 262 | caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key); |
253 | caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); | 263 | List<GridRegion> regions = kvp.Value.GetNeighbours(); |
264 | foreach (GridRegion r in regions) | ||
265 | caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); | ||
266 | } | ||
254 | } | 267 | } |
255 | 268 | ||
256 | MainConsole.Instance.Output(caps.ToString()); | 269 | MainConsole.Instance.Output(caps.ToString()); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 829a7e9..4f674a3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -389,10 +389,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
389 | if (value) | 389 | if (value) |
390 | { | 390 | { |
391 | if (!m_active) | 391 | if (!m_active) |
392 | Start(); | 392 | Start(false); |
393 | } | 393 | } |
394 | else | 394 | else |
395 | { | 395 | { |
396 | // This appears assymetric with Start() above but is not - setting m_active = false stops the loops | ||
397 | // XXX: Possibly this should be in an explicit Stop() method for symmetry. | ||
396 | m_active = false; | 398 | m_active = false; |
397 | } | 399 | } |
398 | } | 400 | } |
@@ -1331,10 +1333,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1331 | } | 1333 | } |
1332 | } | 1334 | } |
1333 | 1335 | ||
1336 | public override void Start() | ||
1337 | { | ||
1338 | Start(true); | ||
1339 | } | ||
1340 | |||
1334 | /// <summary> | 1341 | /// <summary> |
1335 | /// Start the scene | 1342 | /// Start the scene |
1336 | /// </summary> | 1343 | /// </summary> |
1337 | public void Start() | 1344 | /// <param name='startScripts'> |
1345 | /// Start the scripts within the scene. | ||
1346 | /// </param> | ||
1347 | public void Start(bool startScripts) | ||
1338 | { | 1348 | { |
1339 | m_active = true; | 1349 | m_active = true; |
1340 | 1350 | ||
@@ -1353,6 +1363,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1353 | m_heartbeatThread | 1363 | m_heartbeatThread |
1354 | = Watchdog.StartThread( | 1364 | = Watchdog.StartThread( |
1355 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1365 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
1366 | |||
1367 | StartScripts(); | ||
1356 | } | 1368 | } |
1357 | 1369 | ||
1358 | /// <summary> | 1370 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index d3e968e..d2097ea 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -561,6 +561,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
561 | get { return false; } | 561 | get { return false; } |
562 | } | 562 | } |
563 | 563 | ||
564 | public virtual void Start() | ||
565 | { | ||
566 | } | ||
567 | |||
564 | public void Restart() | 568 | public void Restart() |
565 | { | 569 | { |
566 | // This has to be here to fire the event | 570 | // This has to be here to fire the event |