aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r--OpenSim/Framework/RegionInfo.cs38
1 files changed, 2 insertions, 36 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 7de8c52..75ed999 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -420,6 +420,7 @@ namespace OpenSim.Framework
420 set { m_remotingPort = value; } 420 set { m_remotingPort = value; }
421 } 421 }
422 422
423
423 /// <value> 424 /// <value>
424 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. 425 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
425 /// 426 ///
@@ -427,42 +428,7 @@ namespace OpenSim.Framework
427 /// </value> 428 /// </value>
428 public IPEndPoint ExternalEndPoint 429 public IPEndPoint ExternalEndPoint
429 { 430 {
430 get 431 get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); }
431 {
432 // Old one defaults to IPv6
433 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
434
435 IPAddress ia = null;
436 // If it is already an IP, don't resolve it - just return directly
437 if (IPAddress.TryParse(m_externalHostName, out ia))
438 return new IPEndPoint(ia, m_internalEndPoint.Port);
439
440 // Reset for next check
441 ia = null;
442 try
443 {
444 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
445 {
446 if (ia == null)
447 ia = Adr;
448
449 if (Adr.AddressFamily == AddressFamily.InterNetwork)
450 {
451 ia = Adr;
452 break;
453 }
454 }
455 }
456 catch (SocketException e)
457 {
458 throw new Exception(
459 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
460 e + "' attached to this exception", e);
461 }
462
463 return new IPEndPoint(ia, m_internalEndPoint.Port);
464 }
465
466 set { m_externalHostName = value.ToString(); } 432 set { m_externalHostName = value.ToString(); }
467 } 433 }
468 434