aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
diff options
context:
space:
mode:
authorlbsa712007-11-29 06:06:42 +0000
committerlbsa712007-11-29 06:06:42 +0000
commitd05b121dfffdc0521f7e87a7324cfea4a7a37ff7 (patch)
treeddad9e3c02809da77000215045a1226a8205f149 /OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
parentChanged to doing only 1 request to the grid server from main map. Hopefully w... (diff)
downloadopensim-SC-d05b121dfffdc0521f7e87a7324cfea4a7a37ff7.zip
opensim-SC-d05b121dfffdc0521f7e87a7324cfea4a7a37ff7.tar.gz
opensim-SC-d05b121dfffdc0521f7e87a7324cfea4a7a37ff7.tar.bz2
opensim-SC-d05b121dfffdc0521f7e87a7324cfea4a7a37ff7.tar.xz
* Locking on local scope variable does not make sense - every thread will have its own
* Locking on value, then changing it does not make sense - lock will happen on old reference * Taking a local copy of the shared resource then locking on the copy does not make sense - lock will happen on copy
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs50
1 files changed, 22 insertions, 28 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index c531702..905764d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -35,8 +35,8 @@ namespace OpenSim.Region.Environment.Scenes
35 set 35 set
36 { 36 {
37 _debugRegionName = value; 37 _debugRegionName = value;
38 38
39 39
40 40
41 } 41 }
42 } 42 }
@@ -177,10 +177,10 @@ namespace OpenSim.Region.Environment.Scenes
177 List<SimpleRegionInfo> neighbours = 177 List<SimpleRegionInfo> neighbours =
178 m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 178 m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
179 //IPEndPoint blah = new IPEndPoint(); 179 //IPEndPoint blah = new IPEndPoint();
180 180
181 //blah.Address = region.RemotingAddress; 181 //blah.Address = region.RemotingAddress;
182 //blah.Port = region.RemotingPort; 182 //blah.Port = region.RemotingPort;
183 183
184 184
185 } 185 }
186 186
@@ -232,7 +232,7 @@ namespace OpenSim.Region.Environment.Scenes
232 } 232 }
233 233
234 234
235 private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle) 235 private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle)
236 { 236 {
237 MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here"); 237 MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here");
238 bool regionAccepted = m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle); 238 bool regionAccepted = m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle);
@@ -250,29 +250,23 @@ namespace OpenSim.Region.Environment.Scenes
250 public void InformNeighborsThatRegionisUp(RegionInfo region) 250 public void InformNeighborsThatRegionisUp(RegionInfo region)
251 { 251 {
252 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); 252 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
253 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); 253
254 254 List<SimpleRegionInfo> neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
255 lock (neighbours) 255 if (neighbours != null)
256 { 256 {
257 neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 257 for (int i = 0; i < neighbours.Count; i++)
258 if (neighbours != null) 258 {
259 { 259
260 for (int i = 0; i < neighbours.Count; i++) 260 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
261 { 261
262 262 d.BeginInvoke(region, neighbours[i].RegionHandle,
263 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; 263 InformNeighborsThatRegionisUpCompleted,
264 // race condition! Arg! I hate race conditions. 264 d);
265 lock (d) 265 }
266 { 266 }
267 d.BeginInvoke(region, neighbours[i].RegionHandle,
268 InformNeighborsThatRegionisUpCompleted,
269 d);
270 }
271 }
272 }
273 }
274 //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); 267 //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
275 } 268 }
269
276 /// <summary> 270 /// <summary>
277 /// 271 ///
278 /// </summary> 272 /// </summary>
@@ -294,7 +288,7 @@ namespace OpenSim.Region.Environment.Scenes
294 public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) 288 public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
295 { 289 {
296 List<MapBlockData> mapBlocks; 290 List<MapBlockData> mapBlocks;
297 mapBlocks = m_commsProvider.GridService.RequestNeighbourMapBlocks(minX-4, minY-4, minX+4, minY+4); 291 mapBlocks = m_commsProvider.GridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, minX + 4, minY + 4);
298 remoteClient.SendMapBlock(mapBlocks); 292 remoteClient.SendMapBlock(mapBlocks);
299 } 293 }
300 294
@@ -373,7 +367,7 @@ namespace OpenSim.Region.Environment.Scenes
373 { 367 {
374 foreach (ulong regionHandle in presence.KnownChildRegions) 368 foreach (ulong regionHandle in presence.KnownChildRegions)
375 { 369 {
376 370
377 m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId); 371 m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId);
378 presence.RemoveNeighbourRegion(regionHandle); 372 presence.RemoveNeighbourRegion(regionHandle);
379 } 373 }