diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | 99 |
1 files changed, 41 insertions, 58 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 5bcff48..b1663ee 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -53,7 +53,8 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
53 | 53 | ||
54 | private IAssetService m_AssetService; | 54 | private IAssetService m_AssetService; |
55 | 55 | ||
56 | public GatekeeperServiceConnector() : base() | 56 | public GatekeeperServiceConnector() |
57 | : base() | ||
57 | { | 58 | { |
58 | } | 59 | } |
59 | 60 | ||
@@ -123,11 +124,13 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
123 | realHandle = Convert.ToUInt64((string)hash["handle"]); | 124 | realHandle = Convert.ToUInt64((string)hash["handle"]); |
124 | //m_log.Debug(">> HERE, realHandle: " + realHandle); | 125 | //m_log.Debug(">> HERE, realHandle: " + realHandle); |
125 | } | 126 | } |
126 | if (hash["region_image"] != null) { | 127 | if (hash["region_image"] != null) |
128 | { | ||
127 | imageURL = (string)hash["region_image"]; | 129 | imageURL = (string)hash["region_image"]; |
128 | //m_log.Debug(">> HERE, imageURL: " + imageURL); | 130 | //m_log.Debug(">> HERE, imageURL: " + imageURL); |
129 | } | 131 | } |
130 | if (hash["external_name"] != null) { | 132 | if (hash["external_name"] != null) |
133 | { | ||
131 | externalName = (string)hash["external_name"]; | 134 | externalName = (string)hash["external_name"]; |
132 | //m_log.Debug(">> HERE, externalName: " + externalName); | 135 | //m_log.Debug(">> HERE, externalName: " + externalName); |
133 | } | 136 | } |
@@ -178,7 +181,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
178 | //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); | 181 | //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); |
179 | imageData = OpenJPEG.EncodeFromImage(bitmap, true); | 182 | imageData = OpenJPEG.EncodeFromImage(bitmap, true); |
180 | } | 183 | } |
181 | 184 | ||
182 | AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString()); | 185 | AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString()); |
183 | 186 | ||
184 | // !!! for now | 187 | // !!! for now |
@@ -199,10 +202,16 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
199 | return mapTile; | 202 | return mapTile; |
200 | } | 203 | } |
201 | 204 | ||
202 | public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) | 205 | public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID, UUID agentID, string agentHomeURI, out string message) |
203 | { | 206 | { |
204 | Hashtable hash = new Hashtable(); | 207 | Hashtable hash = new Hashtable(); |
205 | hash["region_uuid"] = regionID.ToString(); | 208 | hash["region_uuid"] = regionID.ToString(); |
209 | if (agentID != UUID.Zero) | ||
210 | { | ||
211 | hash["agent_id"] = agentID.ToString(); | ||
212 | if (agentHomeURI != null) | ||
213 | hash["agent_home_uri"] = agentHomeURI; | ||
214 | } | ||
206 | 215 | ||
207 | IList paramList = new ArrayList(); | 216 | IList paramList = new ArrayList(); |
208 | paramList.Add(hash); | 217 | paramList.Add(hash); |
@@ -216,12 +225,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
216 | } | 225 | } |
217 | catch (Exception e) | 226 | catch (Exception e) |
218 | { | 227 | { |
228 | message = "Error contacting grid."; | ||
219 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); | 229 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); |
220 | return null; | 230 | return null; |
221 | } | 231 | } |
222 | 232 | ||
223 | if (response.IsFault) | 233 | if (response.IsFault) |
224 | { | 234 | { |
235 | message = "Error contacting grid."; | ||
225 | m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString); | 236 | m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString); |
226 | return null; | 237 | return null; |
227 | } | 238 | } |
@@ -233,6 +244,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
233 | { | 244 | { |
234 | bool success = false; | 245 | bool success = false; |
235 | Boolean.TryParse((string)hash["result"], out success); | 246 | Boolean.TryParse((string)hash["result"], out success); |
247 | |||
248 | if (hash["message"] != null) | ||
249 | message = (string)hash["message"]; | ||
250 | else if (success) | ||
251 | message = null; | ||
252 | else | ||
253 | message = "The teleport destination could not be found."; // probably the dest grid is old and doesn't send 'message', but the most common problem is that the region is unavailable | ||
254 | |||
236 | if (success) | 255 | if (success) |
237 | { | 256 | { |
238 | GridRegion region = new GridRegion(); | 257 | GridRegion region = new GridRegion(); |
@@ -252,12 +271,25 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
252 | region.RegionLocY = n; | 271 | region.RegionLocY = n; |
253 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | 272 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); |
254 | } | 273 | } |
274 | if (hash["size_x"] != null) | ||
275 | { | ||
276 | Int32.TryParse((string)hash["size_x"], out n); | ||
277 | region.RegionSizeX = n; | ||
278 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
279 | } | ||
280 | if (hash["size_y"] != null) | ||
281 | { | ||
282 | Int32.TryParse((string)hash["size_y"], out n); | ||
283 | region.RegionSizeY = n; | ||
284 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
285 | } | ||
255 | if (hash["region_name"] != null) | 286 | if (hash["region_name"] != null) |
256 | { | 287 | { |
257 | region.RegionName = (string)hash["region_name"]; | 288 | region.RegionName = (string)hash["region_name"]; |
258 | //m_log.Debug(">> HERE, region_name: " + region.RegionName); | 289 | //m_log.Debug(">> HERE, region_name: " + region.RegionName); |
259 | } | 290 | } |
260 | if (hash["hostname"] != null) { | 291 | if (hash["hostname"] != null) |
292 | { | ||
261 | region.ExternalHostName = (string)hash["hostname"]; | 293 | region.ExternalHostName = (string)hash["hostname"]; |
262 | //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); | 294 | //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); |
263 | } | 295 | } |
@@ -275,10 +307,10 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
275 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); | 307 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); |
276 | //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); | 308 | //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); |
277 | } | 309 | } |
278 | 310 | ||
279 | if (hash["server_uri"] != null) | 311 | if (hash["server_uri"] != null) |
280 | { | 312 | { |
281 | region.ServerURI = (string) hash["server_uri"]; | 313 | region.ServerURI = (string)hash["server_uri"]; |
282 | //m_log.Debug(">> HERE, server_uri: " + region.ServerURI); | 314 | //m_log.Debug(">> HERE, server_uri: " + region.ServerURI); |
283 | } | 315 | } |
284 | 316 | ||
@@ -289,61 +321,12 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
289 | } | 321 | } |
290 | catch (Exception e) | 322 | catch (Exception e) |
291 | { | 323 | { |
324 | message = "Error parsing response from grid."; | ||
292 | m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace); | 325 | m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace); |
293 | return null; | 326 | return null; |
294 | } | 327 | } |
295 | 328 | ||
296 | return null; | 329 | return null; |
297 | } | 330 | } |
298 | |||
299 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) | ||
300 | { | ||
301 | // m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: CreateAgent start"); | ||
302 | |||
303 | myipaddress = String.Empty; | ||
304 | reason = String.Empty; | ||
305 | |||
306 | if (destination == null) | ||
307 | { | ||
308 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Given destination is null"); | ||
309 | return false; | ||
310 | } | ||
311 | |||
312 | string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; | ||
313 | |||
314 | try | ||
315 | { | ||
316 | OSDMap args = aCircuit.PackAgentCircuitData(); | ||
317 | |||
318 | args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); | ||
319 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); | ||
320 | args["destination_name"] = OSD.FromString(destination.RegionName); | ||
321 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | ||
322 | args["teleport_flags"] = OSD.FromString(flags.ToString()); | ||
323 | |||
324 | OSDMap result = WebUtil.PostToService(uri, args, 80000); | ||
325 | if (result["Success"].AsBoolean()) | ||
326 | { | ||
327 | OSDMap unpacked = (OSDMap)result["_Result"]; | ||
328 | |||
329 | if (unpacked != null) | ||
330 | { | ||
331 | reason = unpacked["reason"].AsString(); | ||
332 | myipaddress = unpacked["your_ip"].AsString(); | ||
333 | return unpacked["success"].AsBoolean(); | ||
334 | } | ||
335 | } | ||
336 | |||
337 | reason = result["Message"] != null ? result["Message"].AsString() : "error"; | ||
338 | return false; | ||
339 | } | ||
340 | catch (Exception e) | ||
341 | { | ||
342 | m_log.Warn("[REMOTE SIMULATION CONNECTOR]: CreateAgent failed with exception: " + e.ToString()); | ||
343 | reason = e.Message; | ||
344 | } | ||
345 | |||
346 | return false; | ||
347 | } | ||
348 | } | 331 | } |
349 | } | 332 | } |