diff options
author | mingchen | 2007-07-03 14:56:00 +0000 |
---|---|---|
committer | mingchen | 2007-07-03 14:56:00 +0000 |
commit | 898b48464a288e963fc588afc5fb0c9d51bdc755 (patch) | |
tree | fcba29108d5c6524fb1772c26f9568ab605cffc4 /OpenSim/Grid/GridServer/GridManager.cs | |
parent | * Optimized usings (the 'LL ate my scripts' commit) (diff) | |
download | opensim-SC-898b48464a288e963fc588afc5fb0c9d51bdc755.zip opensim-SC-898b48464a288e963fc588afc5fb0c9d51bdc755.tar.gz opensim-SC-898b48464a288e963fc588afc5fb0c9d51bdc755.tar.bz2 opensim-SC-898b48464a288e963fc588afc5fb0c9d51bdc755.tar.xz |
*Renamed OGS1 XmlRpcLoginToSimulatorMethod to the more appropriate XmlRpcSimulatorLoginMethod
*Attempt to fix the "sim not found" issue by adding sim if...well...not found (OGS1)
Diffstat (limited to 'OpenSim/Grid/GridServer/GridManager.cs')
-rw-r--r-- | OpenSim/Grid/GridServer/GridManager.cs | 177 |
1 files changed, 112 insertions, 65 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) |