diff options
author | Diva Canto | 2010-07-30 14:27:53 -0700 |
---|---|---|
committer | Diva Canto | 2010-07-30 14:41:02 -0700 |
commit | 44332d145a7d0ee9d7709fad3145b8e0ec9bd34b (patch) | |
tree | 6e2b46656a8244d01d2afd7ef9a0cffa244ea607 /OpenSim | |
parent | Changed the way HG client verification is done: now transforming local and LA... (diff) | |
download | opensim-SC_OLD-44332d145a7d0ee9d7709fad3145b8e0ec9bd34b.zip opensim-SC_OLD-44332d145a7d0ee9d7709fad3145b8e0ec9bd34b.tar.gz opensim-SC_OLD-44332d145a7d0ee9d7709fad3145b8e0ec9bd34b.tar.bz2 opensim-SC_OLD-44332d145a7d0ee9d7709fad3145b8e0ec9bd34b.tar.xz |
Slight improvement on previous commit.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/NetworkUtil.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs index 7c30bd3..831ff70 100644 --- a/OpenSim/Framework/NetworkUtil.cs +++ b/OpenSim/Framework/NetworkUtil.cs | |||
@@ -188,7 +188,11 @@ namespace OpenSim.Framework | |||
188 | try | 188 | try |
189 | { | 189 | { |
190 | externalIPAddress = GetExternalIP(); | 190 | externalIPAddress = GetExternalIP(); |
191 | } | ||
192 | catch { /* ignore */ } | ||
191 | 193 | ||
194 | try | ||
195 | { | ||
192 | foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) | 196 | foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) |
193 | { | 197 | { |
194 | foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses) | 198 | foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses) |
@@ -252,6 +256,14 @@ namespace OpenSim.Framework | |||
252 | 256 | ||
253 | public static IPAddress GetExternalIPOf(IPAddress user) | 257 | public static IPAddress GetExternalIPOf(IPAddress user) |
254 | { | 258 | { |
259 | if (externalIPAddress == null) | ||
260 | return user; | ||
261 | |||
262 | if (user.ToString() == "127.0.0.1") | ||
263 | { | ||
264 | m_log.Info("[NetworkUtil] 127.0.0.1 user detected, sending '" + externalIPAddress + "' instead of '" + user + "'"); | ||
265 | return externalIPAddress; | ||
266 | } | ||
255 | // Check if we're accessing localhost. | 267 | // Check if we're accessing localhost. |
256 | foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName())) | 268 | foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName())) |
257 | { | 269 | { |
@@ -309,8 +321,8 @@ namespace OpenSim.Framework | |||
309 | } | 321 | } |
310 | catch (WebException we) | 322 | catch (WebException we) |
311 | { | 323 | { |
312 | // do something with exception | ||
313 | m_log.Info("[NetworkUtil]: Exception in GetExternalIP: " + we.ToString()); | 324 | m_log.Info("[NetworkUtil]: Exception in GetExternalIP: " + we.ToString()); |
325 | return null; | ||
314 | } | 326 | } |
315 | 327 | ||
316 | IPAddress externalIp = IPAddress.Parse(requestHtml); | 328 | IPAddress externalIp = IPAddress.Parse(requestHtml); |