aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs18
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs118
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs8
4 files changed, 65 insertions, 81 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 80f0d2d..5092d74 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors
86 86
87 #region IGridService 87 #region IGridService
88 88
89 public virtual string RegisterRegion(UUID scopeID, GridRegion regionInfo) 89 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
90 { 90 {
91 Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs(); 91 Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
92 Dictionary<string, object> sendData = new Dictionary<string,object>(); 92 Dictionary<string, object> sendData = new Dictionary<string,object>();
@@ -140,7 +140,7 @@ namespace OpenSim.Services.Connectors
140 return "Error communicating with grid service"; 140 return "Error communicating with grid service";
141 } 141 }
142 142
143 public virtual bool DeregisterRegion(UUID regionID) 143 public bool DeregisterRegion(UUID regionID)
144 { 144 {
145 Dictionary<string, object> sendData = new Dictionary<string, object>(); 145 Dictionary<string, object> sendData = new Dictionary<string, object>();
146 146
@@ -172,7 +172,7 @@ namespace OpenSim.Services.Connectors
172 return false; 172 return false;
173 } 173 }
174 174
175 public virtual List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) 175 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
176 { 176 {
177 Dictionary<string, object> sendData = new Dictionary<string, object>(); 177 Dictionary<string, object> sendData = new Dictionary<string, object>();
178 178
@@ -219,7 +219,7 @@ namespace OpenSim.Services.Connectors
219 return rinfos; 219 return rinfos;
220 } 220 }
221 221
222 public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) 222 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
223 { 223 {
224 Dictionary<string, object> sendData = new Dictionary<string, object>(); 224 Dictionary<string, object> sendData = new Dictionary<string, object>();
225 225
@@ -265,7 +265,7 @@ namespace OpenSim.Services.Connectors
265 return rinfo; 265 return rinfo;
266 } 266 }
267 267
268 public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 268 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
269 { 269 {
270 Dictionary<string, object> sendData = new Dictionary<string, object>(); 270 Dictionary<string, object> sendData = new Dictionary<string, object>();
271 271
@@ -310,7 +310,7 @@ namespace OpenSim.Services.Connectors
310 return rinfo; 310 return rinfo;
311 } 311 }
312 312
313 public virtual GridRegion GetRegionByName(UUID scopeID, string regionName) 313 public GridRegion GetRegionByName(UUID scopeID, string regionName)
314 { 314 {
315 Dictionary<string, object> sendData = new Dictionary<string, object>(); 315 Dictionary<string, object> sendData = new Dictionary<string, object>();
316 316
@@ -351,7 +351,7 @@ namespace OpenSim.Services.Connectors
351 return rinfo; 351 return rinfo;
352 } 352 }
353 353
354 public virtual List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) 354 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
355 { 355 {
356 Dictionary<string, object> sendData = new Dictionary<string, object>(); 356 Dictionary<string, object> sendData = new Dictionary<string, object>();
357 357
@@ -400,7 +400,7 @@ namespace OpenSim.Services.Connectors
400 return rinfos; 400 return rinfos;
401 } 401 }
402 402
403 public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) 403 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
404 { 404 {
405 Dictionary<string, object> sendData = new Dictionary<string, object>(); 405 Dictionary<string, object> sendData = new Dictionary<string, object>();
406 406
@@ -606,7 +606,7 @@ namespace OpenSim.Services.Connectors
606 return rinfos; 606 return rinfos;
607 } 607 }
608 608
609 public virtual int GetRegionFlags(UUID scopeID, UUID regionID) 609 public int GetRegionFlags(UUID scopeID, UUID regionID)
610 { 610 {
611 Dictionary<string, object> sendData = new Dictionary<string, object>(); 611 Dictionary<string, object> sendData = new Dictionary<string, object>();
612 612
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
index 9c57a40..93da10e 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors
87 87
88 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) 88 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
89 { 89 {
90 string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; 90 string uri = region.ServerURI + "region/" + thisRegion.RegionID + "/";
91 //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); 91 //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
92 92
93 WebRequest HelloNeighbourRequest = WebRequest.Create(uri); 93 WebRequest HelloNeighbourRequest = WebRequest.Create(uri);
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index f86eba3..5584c62 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -51,51 +51,21 @@ namespace OpenSim.Services.Connectors.SimianGrid
51 /// Connects region registration and neighbor lookups to the SimianGrid 51 /// Connects region registration and neighbor lookups to the SimianGrid
52 /// backend 52 /// backend
53 /// </summary> 53 /// </summary>
54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 54 public class SimianGridServiceConnector : IGridService
55 public class SimianGridServiceConnector : IGridService, ISharedRegionModule
56 { 55 {
57 private static readonly ILog m_log = 56 private static readonly ILog m_log =
58 LogManager.GetLogger( 57 LogManager.GetLogger(
59 MethodBase.GetCurrentMethod().DeclaringType); 58 MethodBase.GetCurrentMethod().DeclaringType);
60 59
61 private string m_serverUrl = String.Empty; 60 private string m_ServerURI = String.Empty;
62 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
63 private bool m_Enabled = false; 61 private bool m_Enabled = false;
64 62
65 #region ISharedRegionModule
66
67 public Type ReplaceableInterface { get { return null; } }
68 public void RegionLoaded(Scene scene) { }
69 public void PostInitialise() { }
70 public void Close() { }
71
72 public SimianGridServiceConnector() { } 63 public SimianGridServiceConnector() { }
73 public string Name { get { return "SimianGridServiceConnector"; } } 64 public SimianGridServiceConnector(string serverURI)
74 public void AddRegion(Scene scene)
75 {
76 if (!m_Enabled)
77 return;
78
79 // Every shared region module has to maintain an indepedent list of
80 // currently running regions
81 lock (m_scenes)
82 m_scenes[scene.RegionInfo.RegionID] = scene;
83
84 scene.RegisterModuleInterface<IGridService>(this);
85 }
86 public void RemoveRegion(Scene scene)
87 { 65 {
88 if (!m_Enabled) 66 m_ServerURI = serverURI.TrimEnd('/');
89 return;
90
91 lock (m_scenes)
92 m_scenes.Remove(scene.RegionInfo.RegionID);
93
94 scene.UnregisterModuleInterface<IGridService>(this);
95 } 67 }
96 68
97 #endregion ISharedRegionModule
98
99 public SimianGridServiceConnector(IConfigSource source) 69 public SimianGridServiceConnector(IConfigSource source)
100 { 70 {
101 CommonInit(source); 71 CommonInit(source);
@@ -103,32 +73,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
103 73
104 public void Initialise(IConfigSource source) 74 public void Initialise(IConfigSource source)
105 { 75 {
106 IConfig moduleConfig = source.Configs["Modules"]; 76 CommonInit(source);
107 if (moduleConfig != null)
108 {
109 string name = moduleConfig.GetString("GridServices", "");
110 if (name == Name)
111 CommonInit(source);
112 }
113 } 77 }
114 78
115 private void CommonInit(IConfigSource source) 79 private void CommonInit(IConfigSource source)
116 { 80 {
117 IConfig gridConfig = source.Configs["GridService"]; 81 IConfig gridConfig = source.Configs["GridService"];
118 if (gridConfig != null) 82 if (gridConfig == null)
119 { 83 {
120 string serviceUrl = gridConfig.GetString("GridServerURI"); 84 m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini");
121 if (!String.IsNullOrEmpty(serviceUrl)) 85 throw new Exception("Grid connector init error");
122 {
123 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
124 serviceUrl = serviceUrl + '/';
125 m_serverUrl = serviceUrl;
126 m_Enabled = true;
127 }
128 } 86 }
129 87
130 if (String.IsNullOrEmpty(m_serverUrl)) 88 string serviceUrl = gridConfig.GetString("GridServerURI");
131 m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); 89 if (String.IsNullOrEmpty(serviceUrl))
90 {
91 m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService");
92 throw new Exception("Grid connector init error");
93 }
94
95 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
96 serviceUrl = serviceUrl + '/';
97 m_ServerURI = serviceUrl;
98 m_Enabled = true;
132 } 99 }
133 100
134 #region IGridService 101 #region IGridService
@@ -138,11 +105,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
138 IPEndPoint ext = regionInfo.ExternalEndPoint; 105 IPEndPoint ext = regionInfo.ExternalEndPoint;
139 if (ext == null) return "Region registration for " + regionInfo.RegionName + " failed: Could not resolve EndPoint"; 106 if (ext == null) return "Region registration for " + regionInfo.RegionName + " failed: Could not resolve EndPoint";
140 // Generate and upload our map tile in PNG format to the SimianGrid AddMapTile service 107 // Generate and upload our map tile in PNG format to the SimianGrid AddMapTile service
141 Scene scene; 108// Scene scene;
142 if (m_scenes.TryGetValue(regionInfo.RegionID, out scene)) 109// if (m_scenes.TryGetValue(regionInfo.RegionID, out scene))
143 UploadMapTile(scene); 110// UploadMapTile(scene);
144 else 111// else
145 m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking"); 112// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking");
146 113
147 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 114 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
148 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); 115 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
@@ -173,7 +140,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
173 { "ExtraData", OSDParser.SerializeJsonString(extraData) } 140 { "ExtraData", OSDParser.SerializeJsonString(extraData) }
174 }; 141 };
175 142
176 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 143 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
177 if (response["Success"].AsBoolean()) 144 if (response["Success"].AsBoolean())
178 return String.Empty; 145 return String.Empty;
179 else 146 else
@@ -189,7 +156,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
189 { "Enabled", "0" } 156 { "Enabled", "0" }
190 }; 157 };
191 158
192 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 159 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
193 bool success = response["Success"].AsBoolean(); 160 bool success = response["Success"].AsBoolean();
194 161
195 if (!success) 162 if (!success)
@@ -234,9 +201,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
234 { "SceneID", regionID.ToString() } 201 { "SceneID", regionID.ToString() }
235 }; 202 };
236 203
237 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 204 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString());
205
206 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
238 if (response["Success"].AsBoolean()) 207 if (response["Success"].AsBoolean())
239 { 208 {
209 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString());
240 return ResponseToGridRegion(response); 210 return ResponseToGridRegion(response);
241 } 211 }
242 else 212 else
@@ -259,15 +229,18 @@ namespace OpenSim.Services.Connectors.SimianGrid
259 { "Enabled", "1" } 229 { "Enabled", "1" }
260 }; 230 };
261 231
262 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 232 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString());
233
234 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
263 if (response["Success"].AsBoolean()) 235 if (response["Success"].AsBoolean())
264 { 236 {
237 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString());
265 return ResponseToGridRegion(response); 238 return ResponseToGridRegion(response);
266 } 239 }
267 else 240 else
268 { 241 {
269 //m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", 242 // m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}",
270 // x / Constants.RegionSize, y / Constants.RegionSize); 243 // x / Constants.RegionSize, y / Constants.RegionSize);
271 return null; 244 return null;
272 } 245 }
273 } 246 }
@@ -297,9 +270,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
297 if (maxNumber > 0) 270 if (maxNumber > 0)
298 requestArgs["MaxNumber"] = maxNumber.ToString(); 271 requestArgs["MaxNumber"] = maxNumber.ToString();
299 272
300 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 273 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name);
274
275 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
301 if (response["Success"].AsBoolean()) 276 if (response["Success"].AsBoolean())
302 { 277 {
278 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
279
303 OSDArray array = response["Scenes"] as OSDArray; 280 OSDArray array = response["Scenes"] as OSDArray;
304 if (array != null) 281 if (array != null)
305 { 282 {
@@ -330,7 +307,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
330 { "Enabled", "1" } 307 { "Enabled", "1" }
331 }; 308 };
332 309
333 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 310 m_log.WarnFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString());
311
312
313 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
334 if (response["Success"].AsBoolean()) 314 if (response["Success"].AsBoolean())
335 { 315 {
336 OSDArray array = response["Scenes"] as OSDArray; 316 OSDArray array = response["Scenes"] as OSDArray;
@@ -386,7 +366,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
386 { "SceneID", regionID.ToString() } 366 { "SceneID", regionID.ToString() }
387 }; 367 };
388 368
389 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 369 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString());
370
371 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
390 if (response["Success"].AsBoolean()) 372 if (response["Success"].AsBoolean())
391 { 373 {
392 return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0; 374 return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0;
@@ -432,7 +414,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
432 // Make the remote storage request 414 // Make the remote storage request
433 try 415 try
434 { 416 {
435 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); 417 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
436 418
437 HttpWebResponse response = MultipartForm.Post(request, postParameters); 419 HttpWebResponse response = MultipartForm.Post(request, postParameters);
438 using (Stream responseStream = response.GetResponseStream()) 420 using (Stream responseStream = response.GetResponseStream())
@@ -488,7 +470,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
488 if (onlyEnabled) 470 if (onlyEnabled)
489 requestArgs["Enabled"] = "1"; 471 requestArgs["Enabled"] = "1";
490 472
491 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 473 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
492 if (response["Success"].AsBoolean()) 474 if (response["Success"].AsBoolean())
493 { 475 {
494 return ResponseToGridRegion(response); 476 return ResponseToGridRegion(response);
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 4419201..bbddd87 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -330,10 +330,12 @@ namespace OpenSim.Services.HypergridService
330 if (parts.Length < 2) 330 if (parts.Length < 2)
331 return false; 331 return false;
332 332
333 string addressee = parts[0]; 333 char[] trailing_slash = new char[] { '/' };
334 m_log.DebugFormat("[GATEKEEPER SERVICE]: Verifying {0} against {1}", addressee, m_ExternalName); 334 string addressee = parts[0].TrimEnd(trailing_slash);
335 string externalname = m_ExternalName.TrimEnd(trailing_slash);
336 m_log.DebugFormat("[GATEKEEPER SERVICE]: Verifying {0} against {1}", addressee, externalname);
335 337
336 return string.Equals(addressee, m_ExternalName, StringComparison.OrdinalIgnoreCase); 338 return string.Equals(addressee, externalname, StringComparison.OrdinalIgnoreCase);
337 } 339 }
338 340
339 #endregion 341 #endregion