diff options
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 05c2721..b7fae65 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -361,6 +361,59 @@ namespace OpenSim.Region.Communications.OGS1 | |||
361 | return regionInfo; | 361 | return regionInfo; |
362 | } | 362 | } |
363 | 363 | ||
364 | public RegionInfo RequestClosestRegion(string regionName) | ||
365 | { | ||
366 | // Don't use this method. It's only for SLURLS and Logins | ||
367 | RegionInfo regionInfo = null; | ||
368 | try | ||
369 | { | ||
370 | Hashtable requestData = new Hashtable(); | ||
371 | requestData["region_name_search"] = regionName; | ||
372 | requestData["authkey"] = serversInfo.GridSendKey; | ||
373 | ArrayList SendParams = new ArrayList(); | ||
374 | SendParams.Add(requestData); | ||
375 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
376 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); | ||
377 | |||
378 | Hashtable responseData = (Hashtable) GridResp.Value; | ||
379 | |||
380 | if (responseData.ContainsKey("error")) | ||
381 | { | ||
382 | m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]); | ||
383 | return null; | ||
384 | } | ||
385 | |||
386 | uint regX = Convert.ToUInt32((string) responseData["region_locx"]); | ||
387 | uint regY = Convert.ToUInt32((string) responseData["region_locy"]); | ||
388 | string internalIpStr = (string) responseData["sim_ip"]; | ||
389 | uint port = Convert.ToUInt32(responseData["sim_port"]); | ||
390 | string externalUri = (string) responseData["sim_uri"]; | ||
391 | |||
392 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); | ||
393 | string neighbourExternalUri = externalUri; | ||
394 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); | ||
395 | |||
396 | regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | ||
397 | regionInfo.RemotingAddress = internalIpStr; | ||
398 | |||
399 | regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); | ||
400 | regionInfo.RegionName = (string) responseData["region_name"]; | ||
401 | |||
402 | m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); | ||
403 | } | ||
404 | catch (WebException) | ||
405 | { | ||
406 | m_log.Error("[OGS1 GRID SERVICES]: " + | ||
407 | "Region lookup failed for: " + regionName + | ||
408 | " - Is the GridServer down?"); | ||
409 | } | ||
410 | |||
411 | |||
412 | return regionInfo; | ||
413 | |||
414 | } | ||
415 | |||
416 | |||
364 | /// <summary> | 417 | /// <summary> |
365 | /// | 418 | /// |
366 | /// </summary> | 419 | /// </summary> |