aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2008-03-18 05:44:25 +0000
committerTeravus Ovares2008-03-18 05:44:25 +0000
commit42857fe4e9e898c8e350da2f9acb3b252b31694a (patch)
treede55ab7f5d6d6e1bb127a39f6e97f67e4e442cf4 /OpenSim
parentFormatting cleanup. (diff)
downloadopensim-SC-42857fe4e9e898c8e350da2f9acb3b252b31694a.zip
opensim-SC-42857fe4e9e898c8e350da2f9acb3b252b31694a.tar.gz
opensim-SC-42857fe4e9e898c8e350da2f9acb3b252b31694a.tar.bz2
opensim-SC-42857fe4e9e898c8e350da2f9acb3b252b31694a.tar.xz
* Added the ability to type the partial name of a region in the start location box and go to that region if it's there. If no close match was found, it sends you home. This is tested on mySQL. There's untested code on grids that are based on sqlite and MSSQL. The SQL statements *should* be right, but your results may very.
* Ex, if you want to go to Wright Plaza, you simply need to type Wright Plaza in the start location in the client when you log-in.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/IGridServices.cs1
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oGridData.cs5
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs43
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs41
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteGridData.cs32
-rw-r--r--OpenSim/Framework/Data/GridData.cs7
-rw-r--r--OpenSim/Framework/Data/RegionProfileData.cs42
-rw-r--r--OpenSim/Framework/Util.cs48
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs25
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs38
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs6
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs2
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs53
13 files changed, 338 insertions, 5 deletions
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs
index 14baf3f..3e2a5da 100644
--- a/OpenSim/Framework/Communications/IGridServices.cs
+++ b/OpenSim/Framework/Communications/IGridServices.cs
@@ -36,6 +36,7 @@ namespace OpenSim.Framework.Communications
36 bool DeregisterRegion(RegionInfo regionInfo); 36 bool DeregisterRegion(RegionInfo regionInfo);
37 List<SimpleRegionInfo> RequestNeighbours(uint x, uint y); 37 List<SimpleRegionInfo> RequestNeighbours(uint x, uint y);
38 RegionInfo RequestNeighbourInfo(ulong regionHandle); 38 RegionInfo RequestNeighbourInfo(ulong regionHandle);
39 RegionInfo RequestClosestRegion(string regionName);
39 Dictionary<string, string> GetGridSettings(); 40 Dictionary<string, string> GetGridSettings();
40 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); 41 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
41 } 42 }
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
index b11af82..999d4f8 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
@@ -98,6 +98,11 @@ namespace OpenSim.Framework.Data.DB4o
98 "). Total Registered Regions: " + manager.simProfiles.Count); 98 "). Total Registered Regions: " + manager.simProfiles.Count);
99 } 99 }
100 100
101 public RegionProfileData GetProfileByString(string regionName)
102 {
103 throw new Exception("GetProfileByString Not supported in DB4oGridData");
104 //return null;
105 }
101 /// <summary> 106 /// <summary>
102 /// Adds a new specified region to the database 107 /// Adds a new specified region to the database
103 /// </summary> 108 /// </summary>
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
index 2b91cf9..38a1d08 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
@@ -180,6 +180,49 @@ namespace OpenSim.Framework.Data.MSSQL
180 return row; 180 return row;
181 } 181 }
182 182
183
184 /// <summary>
185 /// Returns a sim profile from it's Region name string
186 /// </summary>
187 /// <param name="uuid">The region name search query</param>
188 /// <returns>The sim profile</returns>
189 public RegionProfileData GetProfileByString(string regionName)
190 {
191 if (regionName.Length > 2)
192 {
193 try
194 {
195 lock (database)
196 {
197 Dictionary<string, string> param = new Dictionary<string, string>();
198 // Add % because this is a like query.
199 param["?regionName"] = regionName + "%";
200 // Order by statement will return shorter matches first. Only returns one record or no record.
201 IDbCommand result = database.Query("SELECT top 1 * FROM " + m_regionsTableName + " WHERE regionName like ?regionName order by regionName", param);
202 IDataReader reader = result.ExecuteReader();
203
204 RegionProfileData row = database.getRegionRow(reader);
205 reader.Close();
206 result.Dispose();
207
208 return row;
209 }
210 }
211 catch (Exception e)
212 {
213 database.Reconnect();
214 m_log.Error(e.ToString());
215 return null;
216 }
217 }
218 else
219 {
220 m_log.Error("[DATABASE]: Searched for a Region Name shorter then 3 characters");
221 return null;
222 }
223 }
224
225
183 /// <summary> 226 /// <summary>
184 /// Adds a new specified region to the database 227 /// Adds a new specified region to the database
185 /// </summary> 228 /// </summary>
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index 584d49c..3855d99 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -249,6 +249,47 @@ namespace OpenSim.Framework.Data.MySQL
249 } 249 }
250 250
251 /// <summary> 251 /// <summary>
252 /// Returns a sim profile from it's Region name string
253 /// </summary>
254 /// <param name="uuid">The region name search query</param>
255 /// <returns>The sim profile</returns>
256 public RegionProfileData GetProfileByString(string regionName)
257 {
258 if (regionName.Length > 2)
259 {
260 try
261 {
262 lock (database)
263 {
264 Dictionary<string, string> param = new Dictionary<string, string>();
265 // Add % because this is a like query.
266 param["?regionName"] = regionName + "%";
267 // Order by statement will return shorter matches first. Only returns one record or no record.
268 IDbCommand result = database.Query("SELECT * FROM regions WHERE regionName like ?regionName order by LENGTH(regionName) asc LIMIT 1", param);
269 IDataReader reader = result.ExecuteReader();
270
271 RegionProfileData row = database.readSimRow(reader);
272 reader.Close();
273 result.Dispose();
274
275 return row;
276 }
277 }
278 catch (Exception e)
279 {
280 database.Reconnect();
281 m_log.Error(e.ToString());
282 return null;
283 }
284 }
285 else
286 {
287 m_log.Error("[DATABASE]: Searched for a Region Name shorter then 3 characters");
288 return null;
289 }
290 }
291
292 /// <summary>
252 /// Adds a new profile to the database 293 /// Adds a new profile to the database
253 /// </summary> 294 /// </summary>
254 /// <param name="profile">The profile to add</param> 295 /// <param name="profile">The profile to add</param>
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
index 6487ba7..4d42f19 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
@@ -112,6 +112,38 @@ namespace OpenSim.Framework.Data.SQLite
112 } 112 }
113 113
114 /// <summary> 114 /// <summary>
115 /// Returns a sim profile from it's Region name string
116 /// </summary>
117 /// <param name="uuid">The region name search query</param>
118 /// <returns>The sim profile</returns>
119 public RegionProfileData GetProfileByString(string regionName)
120 {
121 if (regionName.Length > 2)
122 {
123
124 Dictionary<string, string> param = new Dictionary<string, string>();
125 // Add % because this is a like query.
126 param["?regionName"] = regionName + "%";
127 // Only returns one record or no record.
128 IDbCommand result = database.Query("SELECT * FROM regions WHERE regionName like ?regionName LIMIT 1", param);
129 IDataReader reader = result.ExecuteReader();
130
131 RegionProfileData row = database.getRow(reader);
132 reader.Close();
133 result.Dispose();
134
135 return row;
136
137 }
138 else
139 {
140 //m_log.Error("[DATABASE]: Searched for a Region Name shorter then 3 characters");
141 return null;
142 }
143 }
144
145
146 /// <summary>
115 /// Returns a sim profile from it's UUID 147 /// Returns a sim profile from it's UUID
116 /// </summary> 148 /// </summary>
117 /// <param name="uuid">The region UUID</param> 149 /// <param name="uuid">The region UUID</param>
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs
index 95a568a..5eaa2c4 100644
--- a/OpenSim/Framework/Data/GridData.cs
+++ b/OpenSim/Framework/Data/GridData.cs
@@ -69,6 +69,13 @@ namespace OpenSim.Framework.Data
69 RegionProfileData GetProfileByLLUUID(LLUUID UUID); 69 RegionProfileData GetProfileByLLUUID(LLUUID UUID);
70 70
71 /// <summary> 71 /// <summary>
72 /// Returns a sim profile from a string match
73 /// </summary>
74 /// <param name="regionName">A string for a partial region name match</param>
75 /// <returns>A sim profile</returns>
76 RegionProfileData GetProfileByString(string regionName);
77
78 /// <summary>
72 /// Returns all profiles within the specified range 79 /// Returns all profiles within the specified range
73 /// </summary> 80 /// </summary>
74 /// <param name="Xmin">Minimum sim coordinate (X)</param> 81 /// <param name="Xmin">Minimum sim coordinate (X)</param>
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs
index b541116..f736571 100644
--- a/OpenSim/Framework/Data/RegionProfileData.cs
+++ b/OpenSim/Framework/Data/RegionProfileData.cs
@@ -216,5 +216,47 @@ namespace OpenSim.Framework.Data
216 216
217 return simData; 217 return simData;
218 } 218 }
219
220 /// <summary>
221 /// Request sim profile information from a grid server
222 /// </summary>
223 /// <param name="region_handle"></param>
224 /// <param name="gridserver_url"></param>
225 /// <param name="gridserver_sendkey"></param>
226 /// <param name="gridserver_recvkey"></param>
227 /// <returns>The sim profile. Null if there was a request failure</returns>
228 public static RegionProfileData RequestSimProfileData(string regionName, string gridserver_url,
229 string gridserver_sendkey, string gridserver_recvkey)
230 {
231 Hashtable requestData = new Hashtable();
232 requestData["region_name_search"] = regionName;
233 requestData["authkey"] = gridserver_sendkey;
234 ArrayList SendParams = new ArrayList();
235 SendParams.Add(requestData);
236 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
237 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
238
239 Hashtable responseData = (Hashtable)GridResp.Value;
240
241 if (responseData.ContainsKey("error"))
242 {
243 return null;
244 }
245
246 RegionProfileData simData = new RegionProfileData();
247 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
248 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
249 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
250 simData.serverIP = (string)responseData["sim_ip"];
251 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
252 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]);
253 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
254 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
255 simData.serverURI = (string)responseData["server_uri"];
256 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
257 simData.regionName = (string)responseData["region_name"];
258
259 return simData;
260 }
219 } 261 }
220} 262}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 0f1f0d9..37ddb3e 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -597,5 +597,53 @@ namespace OpenSim.Framework
597 597
598 return ret; 598 return ret;
599 } 599 }
600 public static string[] ParseStartLocationRequest(string startLocationRequest)
601 {
602 string[] returnstring = new string[4];
603 // format uri:RegionName&X&Y&Z
604 returnstring[0] = "last";
605 returnstring[1] = "127";
606 returnstring[2] = "127";
607 returnstring[3] = "0";
608 // This is the crappy way of doing it.
609
610 if (startLocationRequest.Contains(":") && startLocationRequest.Contains("&"))
611 {
612 //System.Console.WriteLine("StartLocationRequest Contains proper elements");
613
614 string[] splitstr = startLocationRequest.Split(':');//,2,StringSplitOptions.RemoveEmptyEntries);
615
616 //System.Console.WriteLine("Found " + splitstr.GetLength(0) + " elements in 1st split result");
617
618 if (splitstr.GetLength(0) == 2)
619 {
620
621 string[] splitstr2 = splitstr[1].Split('&');//, 4, StringSplitOptions.RemoveEmptyEntries);
622
623 //System.Console.WriteLine("Found " + splitstr2.GetLength(0) + " elements in 2nd split result");
624
625 if (splitstr2.GetLength(0) >= 1)
626 {
627 returnstring[0] = splitstr2[0];
628 }
629 if (splitstr2.GetLength(0) >= 2)
630 {
631 returnstring[1] = splitstr2[1];
632 }
633 if (splitstr2.GetLength(0) >= 3)
634 {
635 returnstring[2] = splitstr2[2];
636 }
637 if (splitstr2.GetLength(0) >= 4)
638 {
639 returnstring[3] = splitstr2[3];
640 }
641 }
642
643 }
644 return returnstring;
645
646
647 }
600 } 648 }
601} 649}
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index e9ff91a..86fc445 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -164,6 +164,27 @@ namespace OpenSim.Grid.GridServer
164 return null; 164 return null;
165 } 165 }
166 166
167 /// <summary>
168 /// Returns a region by argument
169 /// </summary>
170 /// <param name="regionName">A partial regionName of the region to return</param>
171 /// <returns>A SimProfileData for the region</returns>
172 public RegionProfileData getRegion(string regionName)
173 {
174 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
175 {
176 try
177 {
178 return kvp.Value.GetProfileByString(regionName);
179 }
180 catch
181 {
182 m_log.Warn("[storage]: Unable to find region " + regionName + " via " + kvp.Key);
183 }
184 }
185 return null;
186 }
187
167 public Dictionary<ulong, RegionProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax) 188 public Dictionary<ulong, RegionProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax)
168 { 189 {
169 Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>(); 190 Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>();
@@ -615,6 +636,10 @@ namespace OpenSim.Grid.GridServer
615 //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); 636 //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
616 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); 637 simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"]));
617 } 638 }
639 else if (requestData.ContainsKey("region_name_search"))
640 {
641 simData = getRegion((string)requestData["region_name_search"]);
642 }
618 643
619 if (simData == null) 644 if (simData == null)
620 { 645 {
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index b85ece9..6cc34d5 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -64,6 +64,8 @@ namespace OpenSim.Grid.UserServer
64 m_config = config; 64 m_config = config;
65 } 65 }
66 66
67
68
67 /// <summary> 69 /// <summary>
68 /// Customises the login response and fills in missing values. 70 /// Customises the login response and fills in missing values.
69 /// </summary> 71 /// </summary>
@@ -95,11 +97,34 @@ namespace OpenSim.Grid.UserServer
95 } 97 }
96 else 98 else
97 { 99 {
98 // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z' 100 string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
99 SimInfo = 101 m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
102 if (startLocationRequestParsed[0] == "last")
103 {
104 // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
105 SimInfo =
106 RegionProfileData.RequestSimProfileData(
107 theUser.currentAgent.currentHandle, m_config.GridServerURL,
108 m_config.GridSendKey, m_config.GridRecvKey);
109 }
110 else
111 {
112 m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
113 SimInfo =
100 RegionProfileData.RequestSimProfileData( 114 RegionProfileData.RequestSimProfileData(
101 theUser.currentAgent.currentHandle, m_config.GridServerURL, 115 startLocationRequestParsed[0], m_config.GridServerURL,
102 m_config.GridSendKey, m_config.GridRecvKey); 116 m_config.GridSendKey, m_config.GridRecvKey);
117
118 if (SimInfo == null)
119 {
120 m_log.Info("[LOGIN]: Didn't find region with a close name match sending to home location");
121 SimInfo =
122 RegionProfileData.RequestSimProfileData(
123 theUser.homeRegion, m_config.GridServerURL,
124 m_config.GridSendKey, m_config.GridRecvKey);
125 }
126
127 }
103 } 128 }
104 129
105 // Customise the response 130 // Customise the response
@@ -132,6 +157,9 @@ namespace OpenSim.Grid.UserServer
132 //CFK: m_log.Info("[LOGIN]: " + SimInfo.regionName + " (" + SimInfo.serverURI + ") " + 157 //CFK: m_log.Info("[LOGIN]: " + SimInfo.regionName + " (" + SimInfo.serverURI + ") " +
133 //CFK: SimInfo.regionLocX + "," + SimInfo.regionLocY); 158 //CFK: SimInfo.regionLocX + "," + SimInfo.regionLocY);
134 159
160 theUser.currentAgent.currentRegion = SimInfo.UUID;
161 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
162
135 // Prepare notification 163 // Prepare notification
136 Hashtable SimParams = new Hashtable(); 164 Hashtable SimParams = new Hashtable();
137 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); 165 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
@@ -149,8 +177,7 @@ namespace OpenSim.Grid.UserServer
149 SendParams.Add(SimParams); 177 SendParams.Add(SimParams);
150 178
151 // Update agent with target sim 179 // Update agent with target sim
152 theUser.currentAgent.currentRegion = SimInfo.UUID; 180
153 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
154 181
155 m_log.Info("[LOGIN]: Telling " 182 m_log.Info("[LOGIN]: Telling "
156 + SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + 183 + SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " +
@@ -175,6 +202,7 @@ namespace OpenSim.Grid.UserServer
175 } 202 }
176 } 203 }
177 catch (Exception) 204 catch (Exception)
205 //catch (System.AccessViolationException)
178 { 206 {
179 tryDefault = true; 207 tryDefault = true;
180 } 208 }
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 5df2e66..8cc1312 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -176,6 +176,12 @@ namespace OpenSim.Region.Communications.Local
176 return null; 176 return null;
177 } 177 }
178 178
179 public RegionInfo RequestClosestRegion(string regionName)
180 {
181 // Don't use this method. It's only for SLURLS and Logins
182 return null;
183 }
184
179 /// <summary> 185 /// <summary>
180 /// 186 ///
181 /// </summary> 187 /// </summary>
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 41f5b3d..eff597e 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -135,6 +135,8 @@ namespace OpenSim.Region.Communications.Local
135 } 135 }
136 else 136 else
137 { 137 {
138 m_log.Info("[LOGIN]: Got Custom Login URL, but can't process it");
139 // LocalBackEndServices can't possibly look up a region by name :(
138 // TODO: Parse string in the following format: 'uri:RegionName&X&Y&Z' 140 // TODO: Parse string in the following format: 'uri:RegionName&X&Y&Z'
139 currentRegion = theUser.currentAgent.currentHandle; 141 currentRegion = theUser.currentAgent.currentHandle;
140 } 142 }
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>