fixing SocketException when IP address cannot be resolved

0.6.5-rc1
Dr Scofield 2009-05-12 14:57:42 +00:00
parent 68da7d1a43
commit c81c9e712c
1 changed files with 15 additions and 8 deletions

View File

@ -27,6 +27,8 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
{ {
IPAddress end = ipEndpoint.EndPoint; IPAddress end = ipEndpoint.EndPoint;
try
{
IPHostEntry rDNS = Dns.GetHostEntry(end); IPHostEntry rDNS = Dns.GetHostEntry(end);
foreach (string ban in bans) foreach (string ban in bans)
{ {
@ -38,7 +40,12 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
return; return;
} }
} }
m_log.Warn("[IPBAN] User '" + end + "' not in any ban lists. Allowing connection."); }
catch (System.Net.Sockets.SocketException sex)
{
m_log.WarnFormat("[IPBAN] IP address \"{0}\" cannot be resolved via DNS", end);
}
m_log.WarnFormat("[IPBAN] User \"{0}\" not in any ban lists. Allowing connection.", end);
} }
} }
} }