aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs (renamed from OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs)83
1 files changed, 36 insertions, 47 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs
index bda354f..60addec 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs
@@ -25,52 +25,40 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net; 28using log4net;
32using Mono.Addins; 29using Mono.Addins;
30using System;
31using System.Reflection;
32using System.Collections.Generic;
33using Nini.Config; 33using Nini.Config;
34using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
36using OpenSim.Server.Base; 35using OpenSim.Services.Connectors;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
40 39
40
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour 41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
42{ 42{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalNeighbourServicesConnector")] 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NeighbourServicesOutConnector")]
44 public class LocalNeighbourServicesConnector : 44 public class NeighbourServicesOutConnector :
45 ISharedRegionModule, INeighbourService 45 NeighbourServicesConnector, ISharedRegionModule, INeighbourService
46 { 46 {
47 private static readonly ILog m_log = 47 private static readonly ILog m_log =
48 LogManager.GetLogger( 48 LogManager.GetLogger(
49 MethodBase.GetCurrentMethod().DeclaringType); 49 MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 private List<Scene> m_Scenes = new List<Scene>(); 51 private List<Scene> m_Scenes = new List<Scene>();
52
53 private bool m_Enabled = false; 52 private bool m_Enabled = false;
54 53
55 public LocalNeighbourServicesConnector() 54 public Type ReplaceableInterface
56 {
57 }
58
59 public LocalNeighbourServicesConnector(List<Scene> scenes)
60 {
61 m_Scenes = scenes;
62 }
63
64 #region ISharedRegionModule
65
66 public Type ReplaceableInterface
67 { 55 {
68 get { return null; } 56 get { return null; }
69 } 57 }
70 58
71 public string Name 59 public string Name
72 { 60 {
73 get { return "LocalNeighbourServicesConnector"; } 61 get { return "NeighbourServicesOutConnector"; }
74 } 62 }
75 63
76 public void Initialise(IConfigSource source) 64 public void Initialise(IConfigSource source)
@@ -78,68 +66,69 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
78 IConfig moduleConfig = source.Configs["Modules"]; 66 IConfig moduleConfig = source.Configs["Modules"];
79 if (moduleConfig != null) 67 if (moduleConfig != null)
80 { 68 {
81 string name = moduleConfig.GetString("NeighbourServices", this.Name); 69 string name = moduleConfig.GetString("NeighbourServices");
82 if (name == Name) 70 if (name == Name)
83 { 71 {
84 // m_Enabled rules whether this module registers as INeighbourService or not
85 m_Enabled = true; 72 m_Enabled = true;
86 m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled"); 73 m_log.Info("[NEIGHBOUR CONNECTOR]: Neighbour out connector enabled");
87 } 74 }
88 } 75 }
89 } 76 }
90 77
78 public void PostInitialise()
79 {
80 }
81
91 public void Close() 82 public void Close()
92 { 83 {
93 } 84 }
94 85
95 public void AddRegion(Scene scene) 86 public void AddRegion(Scene scene)
96 { 87 {
97 m_Scenes.Add(scene);
98
99 if (!m_Enabled) 88 if (!m_Enabled)
100 return; 89 return;
101 90
91 m_Scenes.Add(scene);
102 scene.RegisterModuleInterface<INeighbourService>(this); 92 scene.RegisterModuleInterface<INeighbourService>(this);
103 } 93 }
104 94
105 public void RegionLoaded(Scene scene)
106 {
107 m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled for region " + scene.RegionInfo.RegionName);
108 }
109
110 public void PostInitialise()
111 {
112 }
113
114 public void RemoveRegion(Scene scene) 95 public void RemoveRegion(Scene scene)
115 { 96 {
116 // Always remove 97 // Always remove
117 if (m_Scenes.Contains(scene)) 98 if (m_Scenes.Contains(scene))
118 m_Scenes.Remove(scene); 99 m_Scenes.Remove(scene);
119 } 100 }
120 101
121 #endregion ISharedRegionModule 102 public void RegionLoaded(Scene scene)
103 {
104 if (!m_Enabled)
105 return;
106
107 m_GridService = scene.GridService;
108 m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled out neighbours for region {0}", scene.RegionInfo.RegionName);
109
110 }
122 111
123 #region INeighbourService 112 #region INeighbourService
124 113
125 public OpenSim.Services.Interfaces.GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 114 public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
126 { 115 {
127 uint x, y; 116 if (!m_Enabled)
128 Util.RegionHandleToRegionLoc(regionHandle, out x, out y); 117 return null;
129 118
130 foreach (Scene s in m_Scenes) 119 foreach (Scene s in m_Scenes)
131 { 120 {
132 if (s.RegionInfo.RegionHandle == regionHandle) 121 if (s.RegionInfo.RegionHandle == regionHandle)
133 { 122 {
134 m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}", 123// uint x, y;
135 thisRegion.RegionName, s.Name, x, y ); 124// Util.RegionHandleToRegionLoc(regionHandle, out x, out y);
136 125// m_log.DebugFormat("[NEIGHBOUR SERVICE OUT CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}",
137 //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); 126// thisRegion.RegionName, s.Name, x, y );
138 return s.IncomingHelloNeighbour(thisRegion); 127 return s.IncomingHelloNeighbour(thisRegion);
139 } 128 }
140 } 129 }
141 //m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); 130
142 return null; 131 return base.HelloNeighbour(regionHandle, thisRegion);
143 } 132 }
144 133
145 #endregion INeighbourService 134 #endregion INeighbourService