aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs104
1 files changed, 56 insertions, 48 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 3719c97..d9af95b 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -35,14 +35,12 @@ using System.Runtime.Remoting;
35using System.Runtime.Remoting.Channels; 35using System.Runtime.Remoting.Channels;
36using System.Runtime.Remoting.Channels.Tcp; 36using System.Runtime.Remoting.Channels.Tcp;
37using System.Security.Authentication; 37using System.Security.Authentication;
38
39using libsecondlife; 38using libsecondlife;
40using Nwc.XmlRpc; 39using Nwc.XmlRpc;
41using OpenSim.Framework; 40using OpenSim.Framework;
42using OpenSim.Framework.Communications; 41using OpenSim.Framework.Communications;
43using OpenSim.Framework.Console; 42using OpenSim.Framework.Console;
44using OpenSim.Framework.Servers; 43using OpenSim.Framework.Servers;
45using OpenSim.Framework;
46using OpenSim.Region.Communications.Local; 44using OpenSim.Region.Communications.Local;
47 45
48namespace OpenSim.Region.Communications.OGS1 46namespace OpenSim.Region.Communications.OGS1
@@ -65,10 +63,10 @@ namespace OpenSim.Region.Communications.OGS1
65 { 63 {
66 serversInfo = servers_info; 64 serversInfo = servers_info;
67 httpServer = httpServe; 65 httpServer = httpServe;
68 httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser); 66 httpServer.AddXmlRPCHandler("expect_user", ExpectUser);
69 httpServer.AddXmlRPCHandler("check", this.PingCheckReply); 67 httpServer.AddXmlRPCHandler("check", PingCheckReply);
70 68
71 this.StartRemoting(); 69 StartRemoting();
72 } 70 }
73 71
74 /// <summary> 72 /// <summary>
@@ -99,14 +97,14 @@ namespace OpenSim.Region.Communications.OGS1
99 // Send Request 97 // Send Request
100 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); 98 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
101 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000); 99 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000);
102 Hashtable GridRespData = (Hashtable)GridResp.Value; 100 Hashtable GridRespData = (Hashtable) GridResp.Value;
103 101
104 Hashtable griddatahash = GridRespData; 102 Hashtable griddatahash = GridRespData;
105 103
106 // Process Response 104 // Process Response
107 if (GridRespData.ContainsKey("error")) 105 if (GridRespData.ContainsKey("error"))
108 { 106 {
109 string errorstring = (string)GridRespData["error"]; 107 string errorstring = (string) GridRespData["error"];
110 MainLog.Instance.Error("Unable to connect to grid: " + errorstring); 108 MainLog.Instance.Error("Unable to connect to grid: " + errorstring);
111 return null; 109 return null;
112 } 110 }
@@ -121,8 +119,7 @@ namespace OpenSim.Region.Communications.OGS1
121 /// <returns></returns> 119 /// <returns></returns>
122 public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) 120 public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
123 { 121 {
124 122 Hashtable respData = MapBlockQuery((int) x - 1, (int) y - 1, (int) x + 1, (int) y + 1);
125 Hashtable respData = MapBlockQuery((int)x - 1, (int)y - 1, (int)x + 1, (int)y + 1);
126 123
127 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); 124 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
128 125
@@ -134,16 +131,15 @@ namespace OpenSim.Region.Communications.OGS1
134 uint regY = Convert.ToUInt32(neighbourData["y"]); 131 uint regY = Convert.ToUInt32(neighbourData["y"]);
135 if ((x != regX) || (y != regY)) 132 if ((x != regX) || (y != regY))
136 { 133 {
137 134 string simIp = (string) neighbourData["sim_ip"];
138 string simIp = (string)neighbourData["sim_ip"];
139 135
140 int port = Convert.ToInt32(neighbourData["sim_port"]); 136 int port = Convert.ToInt32(neighbourData["sim_port"]);
141 string externalUri = (string)neighbourData["sim_uri"]; 137 string externalUri = (string) neighbourData["sim_uri"];
142 138
143 string externalIpStr = OpenSim.Framework.Util.GetHostFromDNS(simIp).ToString(); 139 string externalIpStr = Util.GetHostFromDNS(simIp).ToString();
144 SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port); 140 SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port);
145 sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]); 141 sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]);
146 sri.RegionID = new LLUUID((string)neighbourData["uuid"]); 142 sri.RegionID = new LLUUID((string) neighbourData["uuid"]);
147 143
148 neighbours.Add(sri); 144 neighbours.Add(sri);
149 } 145 }
@@ -175,11 +171,11 @@ namespace OpenSim.Region.Communications.OGS1
175 { 171 {
176 Hashtable requestData = new Hashtable(); 172 Hashtable requestData = new Hashtable();
177 requestData["region_handle"] = regionHandle.ToString(); 173 requestData["region_handle"] = regionHandle.ToString();
178 requestData["authkey"] = this.serversInfo.GridSendKey; 174 requestData["authkey"] = serversInfo.GridSendKey;
179 ArrayList SendParams = new ArrayList(); 175 ArrayList SendParams = new ArrayList();
180 SendParams.Add(requestData); 176 SendParams.Add(requestData);
181 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 177 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
182 XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000); 178 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
183 179
184 Hashtable responseData = (Hashtable) GridResp.Value; 180 Hashtable responseData = (Hashtable) GridResp.Value;
185 181
@@ -205,7 +201,7 @@ namespace OpenSim.Region.Communications.OGS1
205 regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); 201 regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
206 regionInfo.RegionName = (string) responseData["region_name"]; 202 regionInfo.RegionName = (string) responseData["region_name"];
207 203
208 m_remoteRegionInfoCache.Add( regionHandle, regionInfo ); 204 m_remoteRegionInfoCache.Add(regionHandle, regionInfo);
209 } 205 }
210 206
211 return regionInfo; 207 return regionInfo;
@@ -234,11 +230,11 @@ namespace OpenSim.Region.Communications.OGS1
234 neighbour.X = Convert.ToUInt16(n["x"]); 230 neighbour.X = Convert.ToUInt16(n["x"]);
235 neighbour.Y = Convert.ToUInt16(n["y"]); 231 neighbour.Y = Convert.ToUInt16(n["y"]);
236 232
237 neighbour.Name = (string)n["name"]; 233 neighbour.Name = (string) n["name"];
238 neighbour.Access = Convert.ToByte(n["access"]); 234 neighbour.Access = Convert.ToByte(n["access"]);
239 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); 235 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]);
240 neighbour.WaterHeight = Convert.ToByte(n["water-height"]); 236 neighbour.WaterHeight = Convert.ToByte(n["water-height"]);
241 neighbour.MapImageId = new LLUUID((string)n["map-image-id"]); 237 neighbour.MapImageId = new LLUUID((string) n["map-image-id"]);
242 238
243 neighbours.Add(neighbour); 239 neighbours.Add(neighbour);
244 } 240 }
@@ -267,7 +263,7 @@ namespace OpenSim.Region.Communications.OGS1
267 parameters.Add(param); 263 parameters.Add(param);
268 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); 264 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
269 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000); 265 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000);
270 Hashtable respData = (Hashtable)resp.Value; 266 Hashtable respData = (Hashtable) resp.Value;
271 return respData; 267 return respData;
272 } 268 }
273 269
@@ -300,15 +296,15 @@ namespace OpenSim.Region.Communications.OGS1
300 public XmlRpcResponse ExpectUser(XmlRpcRequest request) 296 public XmlRpcResponse ExpectUser(XmlRpcRequest request)
301 { 297 {
302 Console.WriteLine("Expecting User..."); 298 Console.WriteLine("Expecting User...");
303 Hashtable requestData = (Hashtable)request.Params[0]; 299 Hashtable requestData = (Hashtable) request.Params[0];
304 AgentCircuitData agentData = new AgentCircuitData(); 300 AgentCircuitData agentData = new AgentCircuitData();
305 agentData.SessionID = new LLUUID((string)requestData["session_id"]); 301 agentData.SessionID = new LLUUID((string) requestData["session_id"]);
306 agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); 302 agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]);
307 agentData.firstname = (string)requestData["firstname"]; 303 agentData.firstname = (string) requestData["firstname"];
308 agentData.lastname = (string)requestData["lastname"]; 304 agentData.lastname = (string) requestData["lastname"];
309 agentData.AgentID = new LLUUID((string)requestData["agent_id"]); 305 agentData.AgentID = new LLUUID((string) requestData["agent_id"]);
310 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 306 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
311 agentData.CapsPath = (string)requestData["caps_path"]; 307 agentData.CapsPath = (string) requestData["caps_path"];
312 308
313 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) 309 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
314 { 310 {
@@ -316,12 +312,14 @@ namespace OpenSim.Region.Communications.OGS1
316 } 312 }
317 else 313 else
318 { 314 {
319 agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); 315 agentData.startpos =
316 new LLVector3(Convert.ToUInt32(requestData["startpos_x"]),
317 Convert.ToUInt32(requestData["startpos_y"]),
318 Convert.ToUInt32(requestData["startpos_z"]));
320 agentData.child = false; 319 agentData.child = false;
321
322 } 320 }
323 321
324 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); 322 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
325 323
326 m_localBackend.TriggerExpectUser(regionHandle, agentData); 324 m_localBackend.TriggerExpectUser(regionHandle, agentData);
327 325
@@ -331,6 +329,7 @@ namespace OpenSim.Region.Communications.OGS1
331 } 329 }
332 330
333 #region m_interRegion Comms 331 #region m_interRegion Comms
332
334 /// <summary> 333 /// <summary>
335 /// 334 ///
336 /// </summary> 335 /// </summary>
@@ -339,13 +338,16 @@ namespace OpenSim.Region.Communications.OGS1
339 TcpChannel ch = new TcpChannel(NetworkServersInfo.RemotingListenerPort); 338 TcpChannel ch = new TcpChannel(NetworkServersInfo.RemotingListenerPort);
340 ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this. 339 ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this.
341 340
342 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); 341 WellKnownServiceTypeEntry wellType =
342 new WellKnownServiceTypeEntry(typeof (OGS1InterRegionRemoting), "InterRegions",
343 WellKnownObjectMode.Singleton);
343 RemotingConfiguration.RegisterWellKnownServiceType(wellType); 344 RemotingConfiguration.RegisterWellKnownServiceType(wellType);
344 InterRegionSingleton.Instance.OnArrival += this.TriggerExpectAvatarCrossing; 345 InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing;
345 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; 346 InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent;
346 } 347 }
347 348
348 #region Methods called by regions in this instance 349 #region Methods called by regions in this instance
350
349 /// <summary> 351 /// <summary>
350 /// 352 ///
351 /// </summary> 353 /// </summary>
@@ -361,17 +363,19 @@ namespace OpenSim.Region.Communications.OGS1
361 return true; 363 return true;
362 } 364 }
363 365
364 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); 366 RegionInfo regInfo = RequestNeighbourInfo(regionHandle);
365 if (regInfo != null) 367 if (regInfo != null)
366 { 368 {
367 //don't want to be creating a new link to the remote instance every time like we are here 369 //don't want to be creating a new link to the remote instance every time like we are here
368 bool retValue = false; 370 bool retValue = false;
369 371
370 372
371 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 373 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
372 typeof(OGS1InterRegionRemoting), 374 typeof (OGS1InterRegionRemoting),
373 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); 375 "tcp://" + regInfo.RemotingAddress +
374 376 ":" + regInfo.RemotingPort +
377 "/InterRegions");
378
375 if (remObject != null) 379 if (remObject != null)
376 { 380 {
377 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); 381 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData);
@@ -388,7 +392,7 @@ namespace OpenSim.Region.Communications.OGS1
388 392
389 return false; 393 return false;
390 } 394 }
391 catch (System.Runtime.Remoting.RemotingException e) 395 catch (RemotingException e)
392 { 396 {
393 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 397 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
394 return false; 398 return false;
@@ -432,13 +436,15 @@ namespace OpenSim.Region.Communications.OGS1
432 return true; 436 return true;
433 } 437 }
434 438
435 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); 439 RegionInfo regInfo = RequestNeighbourInfo(regionHandle);
436 if (regInfo != null) 440 if (regInfo != null)
437 { 441 {
438 bool retValue = false; 442 bool retValue = false;
439 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 443 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
440 typeof(OGS1InterRegionRemoting), 444 typeof (OGS1InterRegionRemoting),
441 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); 445 "tcp://" + regInfo.RemotingAddress +
446 ":" + regInfo.RemotingPort +
447 "/InterRegions");
442 if (remObject != null) 448 if (remObject != null)
443 { 449 {
444 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 450 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
@@ -455,7 +461,7 @@ namespace OpenSim.Region.Communications.OGS1
455 // to inform it. 461 // to inform it.
456 return false; 462 return false;
457 } 463 }
458 catch (System.Runtime.Remoting.RemotingException e) 464 catch (RemotingException e)
459 { 465 {
460 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 466 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
461 return false; 467 return false;
@@ -474,6 +480,7 @@ namespace OpenSim.Region.Communications.OGS1
474 #endregion 480 #endregion
475 481
476 #region Methods triggered by calls from external instances 482 #region Methods triggered by calls from external instances
483
477 /// <summary> 484 /// <summary>
478 /// 485 ///
479 /// </summary> 486 /// </summary>
@@ -486,7 +493,7 @@ namespace OpenSim.Region.Communications.OGS1
486 { 493 {
487 return m_localBackend.IncomingChildAgent(regionHandle, agentData); 494 return m_localBackend.IncomingChildAgent(regionHandle, agentData);
488 } 495 }
489 catch (System.Runtime.Remoting.RemotingException e) 496 catch (RemotingException e)
490 { 497 {
491 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 498 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
492 return false; 499 return false;
@@ -502,18 +509,19 @@ namespace OpenSim.Region.Communications.OGS1
502 /// <returns></returns> 509 /// <returns></returns>
503 public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 510 public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
504 { 511 {
505
506 try 512 try
507 { 513 {
508 return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 514 return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
509 } 515 }
510 catch (System.Runtime.Remoting.RemotingException e) 516 catch (RemotingException e)
511 { 517 {
512 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 518 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
513 return false; 519 return false;
514 } 520 }
515 } 521 }
522
516 #endregion 523 #endregion
524
517 #endregion 525 #endregion
518 } 526 }
519} 527} \ No newline at end of file