Attempting a work around for DNS host resolution. There will now be a configuration parameter that will enable the check. This is expensive, and not recommended, but a better reserved slot system will be done in the future.

Closes #254
This commit is contained in:
Lucas Nicodemus 2011-07-19 17:27:54 -06:00
parent d6c1f44219
commit 407d327236
3 changed files with 41 additions and 4 deletions

View file

@ -222,6 +222,36 @@ namespace TShockAPI.DB
}
return Tools.GetGroup("default");
}
public Group GetGroupForIPExpensive(string ip)
{
try
{
using (var com = database.CreateCommand())
{
com.CommandText = "SELECT * FROM Users";
using (var reader = com.ExecuteReader())
{
while(reader.Read())
{
if (Tools.GetIPv4Address(reader.Get<string>("IP")) == ip)
{
string group = reader.Get<string>("UserGroup");
return Tools.GetGroup(group);
}
}
}
}
}
catch (Exception ex)
{
Log.ConsoleError("GetGroupForIP SQL returned an error: " + ex.ToString());
}
return Tools.GetGroup("default");
}
public User GetUserByName(string name)
{
try