aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs177
-rw-r--r--OpenSim/Grid/GridServer/Main.cs2
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs2
3 files changed, 114 insertions, 67 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 7986591..824a39e 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -180,6 +180,8 @@ namespace OpenSim.Grid.GridServer
180 return regions; 180 return regions;
181 } 181 }
182 182
183
184
183 /// <summary> 185 /// <summary>
184 /// Returns a XML String containing a list of the neighbouring regions 186 /// Returns a XML String containing a list of the neighbouring regions
185 /// </summary> 187 /// </summary>
@@ -213,8 +215,10 @@ namespace OpenSim.Grid.GridServer
213 /// </summary> 215 /// </summary>
214 /// <param name="request">The XMLRPC Request</param> 216 /// <param name="request">The XMLRPC Request</param>
215 /// <returns>Startup parameters</returns> 217 /// <returns>Startup parameters</returns>
216 public XmlRpcResponse XmlRpcLoginToSimulatorMethod(XmlRpcRequest request) 218 public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request)
217 { 219 {
220 Console.WriteLine("XMLRPC SIMULATOR LOGIN METHOD CALLED");
221
218 XmlRpcResponse response = new XmlRpcResponse(); 222 XmlRpcResponse response = new XmlRpcResponse();
219 Hashtable responseData = new Hashtable(); 223 Hashtable responseData = new Hashtable();
220 response.Value = responseData; 224 response.Value = responseData;
@@ -222,16 +226,18 @@ namespace OpenSim.Grid.GridServer
222 SimProfileData TheSim = null; 226 SimProfileData TheSim = null;
223 Hashtable requestData = (Hashtable)request.Params[0]; 227 Hashtable requestData = (Hashtable)request.Params[0];
224 228
225 Console.WriteLine("WOOT: " + requestData.ToString()); 229 Console.WriteLine(requestData.ToString());
226 if (requestData.ContainsKey("UUID")) 230 if (requestData.ContainsKey("UUID"))
227 { 231 {
232 Console.WriteLine("...VIA UUID");
228 TheSim = getRegion(new LLUUID((string)requestData["UUID"])); 233 TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
229 logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcLoginToSimulatorMethod","", 5,"Region attempting login with UUID."); 234 logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
230 } 235 }
231 else if (requestData.ContainsKey("region_handle")) 236 else if (requestData.ContainsKey("region_handle"))
232 { 237 {
238
233 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); 239 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
234 logToDB((string)requestData["region_handle"], "XmlRpcLoginToSimulatorMethod", "", 5, "Region attempting login with regionHandle."); 240 logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
235 } 241 }
236 else 242 else
237 { 243 {
@@ -241,78 +247,119 @@ namespace OpenSim.Grid.GridServer
241 247
242 if (TheSim == null) 248 if (TheSim == null)
243 { 249 {
244 responseData["error"] = "sim not found"; 250 //NEW REGION
245 return response; 251 Console.WriteLine("THIS IS A NEW REGION...ADDING");
246 } 252 TheSim = new SimProfileData();
247 else
248 {
249
250 ArrayList SimNeighboursData = new ArrayList();
251
252 SimProfileData neighbour;
253 Hashtable NeighbourBlock;
254 253
255 bool fastMode = false; // Only compatible with MySQL right now 254 TheSim.regionRecvKey = config.SimRecvKey;
255 TheSim.regionSendKey = config.SimSendKey;
256 TheSim.regionSecret = config.SimRecvKey;
257 TheSim.regionDataURI = "";
258 TheSim.regionAssetURI = config.DefaultAssetServer;
259 TheSim.regionAssetRecvKey = config.AssetRecvKey;
260 TheSim.regionAssetSendKey = config.AssetSendKey;
261 TheSim.regionUserURI = config.DefaultUserServer;
262 TheSim.regionUserSendKey = config.UserSendKey;
263 TheSim.regionUserRecvKey = config.UserRecvKey;
264
265 TheSim.serverIP = (string)requestData["sim_ip"];
266 TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
267 TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
268 TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
269 TheSim.regionLocZ = 0;
270
271 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
272 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
273
274 TheSim.regionName = (string)requestData["sim_name"];
256 275
257 if (fastMode) 276 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
258 { 277 {
259 Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); 278 try
260 279 {
261 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) 280 Console.WriteLine("ADDED");kvp.Value.AddProfile(TheSim);
281 }
282 catch (Exception)
262 { 283 {
263 NeighbourBlock = new Hashtable(); 284 OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key);
264 NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString();
265 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
266 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
267 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
268 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
269
270 if (aSim.Value.UUID != TheSim.UUID)
271 SimNeighboursData.Add(NeighbourBlock);
272 } 285 }
273 } 286 }
274 else 287
288
289 if (getRegion(TheSim.regionHandle) == null)
275 { 290 {
276 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) 291 responseData["error"] = "Unable to add new region";
277 { 292 return response;
278 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null)
279 {
280 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256));
281
282 NeighbourBlock = new Hashtable();
283 NeighbourBlock["sim_ip"] = neighbour.serverIP;
284 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
285 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
286 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
287 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
288
289 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
290 }
291 }
292 } 293 }
294 }
295
293 296
294 responseData["UUID"] = TheSim.UUID.ToString(); 297 ArrayList SimNeighboursData = new ArrayList();
295 responseData["region_locx"] = TheSim.regionLocX.ToString(); 298
296 responseData["region_locy"] = TheSim.regionLocY.ToString(); 299 SimProfileData neighbour;
297 responseData["regionname"] = TheSim.regionName; 300 Hashtable NeighbourBlock;
298 responseData["estate_id"] = "1"; 301
299 responseData["neighbours"] = SimNeighboursData; 302 bool fastMode = false; // Only compatible with MySQL right now
300 303
301 responseData["sim_ip"] = TheSim.serverIP; 304 if (fastMode)
302 responseData["sim_port"] = TheSim.serverPort.ToString(); 305 {
303 responseData["asset_url"] = TheSim.regionAssetURI; 306 Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1);
304 responseData["asset_sendkey"] = TheSim.regionAssetSendKey; 307
305 responseData["asset_recvkey"] = TheSim.regionAssetRecvKey; 308 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours)
306 responseData["user_url"] = TheSim.regionUserURI; 309 {
307 responseData["user_sendkey"] = TheSim.regionUserSendKey; 310 NeighbourBlock = new Hashtable();
308 responseData["user_recvkey"] = TheSim.regionUserRecvKey; 311 NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString();
309 responseData["authkey"] = TheSim.regionSecret; 312 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
310 313 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
311 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) 314 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
312 responseData["data_uri"] = TheSim.regionDataURI; 315 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
316
317 if (aSim.Value.UUID != TheSim.UUID)
318 SimNeighboursData.Add(NeighbourBlock);
319 }
313 } 320 }
321 else
322 {
323 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
324 {
325 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null)
326 {
327 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256));
314 328
315 return response; 329 NeighbourBlock = new Hashtable();
330 NeighbourBlock["sim_ip"] = neighbour.serverIP;
331 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
332 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
333 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
334 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
335
336 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
337 }
338 }
339 }
340
341 responseData["UUID"] = TheSim.UUID.ToString();
342 responseData["region_locx"] = TheSim.regionLocX.ToString();
343 responseData["region_locy"] = TheSim.regionLocY.ToString();
344 responseData["regionname"] = TheSim.regionName;
345 responseData["estate_id"] = "1";
346 responseData["neighbours"] = SimNeighboursData;
347
348 responseData["sim_ip"] = TheSim.serverIP;
349 responseData["sim_port"] = TheSim.serverPort.ToString();
350 responseData["asset_url"] = TheSim.regionAssetURI;
351 responseData["asset_sendkey"] = TheSim.regionAssetSendKey;
352 responseData["asset_recvkey"] = TheSim.regionAssetRecvKey;
353 responseData["user_url"] = TheSim.regionUserURI;
354 responseData["user_sendkey"] = TheSim.regionUserSendKey;
355 responseData["user_recvkey"] = TheSim.regionUserRecvKey;
356 responseData["authkey"] = TheSim.regionSecret;
357
358 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
359 responseData["data_uri"] = TheSim.regionDataURI;
360
361
362 return response;
316 } 363 }
317 364
318 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) 365 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index 20c4905..509549e 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -123,7 +123,7 @@ namespace OpenSim.Grid.GridServer
123 BaseHttpServer httpServer = new BaseHttpServer(8001); 123 BaseHttpServer httpServer = new BaseHttpServer(8001);
124 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); 124 //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback);
125 125
126 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod); 126 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod);
127 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); 127 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
128 128
129 httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); 129 httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 1706c6d..0ef327e 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -20,7 +20,6 @@ namespace OpenSim.Region.Communications.OGS1
20 public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>(); 20 public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>();
21 public GridInfo grid; 21 public GridInfo grid;
22 public BaseHttpServer httpListener; 22 public BaseHttpServer httpListener;
23 private bool initialised = false;
24 23
25 public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo) 24 public RegionCommsListener RegisterRegion(RegionInfo regionInfo, GridInfo gridInfo)
26 { 25 {
@@ -44,6 +43,7 @@ namespace OpenSim.Region.Communications.OGS1
44 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); 43 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
45 XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000); 44 XmlRpcResponse GridResp = GridReq.Send(gridInfo.GridServerURI, 3000);
46 Hashtable GridRespData = (Hashtable)GridResp.Value; 45 Hashtable GridRespData = (Hashtable)GridResp.Value;
46
47 Hashtable griddatahash = GridRespData; 47 Hashtable griddatahash = GridRespData;
48 48
49 // Process Response 49 // Process Response