aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
diff options
context:
space:
mode:
authorMelanie2009-09-28 23:03:47 +0100
committerMelanie2009-09-28 23:03:47 +0100
commit07091493134341a316624d9a1f6a2ef1cfa2f2d8 (patch)
tree1d394e128be9766656a441058b2bdf141ba90269 /OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
parentAllow the notation config_name@port/dll_name:class_name as a handler spec (diff)
parentForgot a return statement. (diff)
downloadopensim-SC_OLD-07091493134341a316624d9a1f6a2ef1cfa2f2d8.zip
opensim-SC_OLD-07091493134341a316624d9a1f6a2ef1cfa2f2d8.tar.gz
opensim-SC_OLD-07091493134341a316624d9a1f6a2ef1cfa2f2d8.tar.bz2
opensim-SC_OLD-07091493134341a316624d9a1f6a2ef1cfa2f2d8.tar.xz
Merge branch 'grid-service-redux'
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs52
1 files changed, 52 insertions, 0 deletions
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}