1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

Miscellanous fixes

This commit is contained in:
RaidMax
2017-11-13 15:58:23 -06:00
parent 07e3c61e98
commit e64a216cc0
11 changed files with 260 additions and 163 deletions

View File

@ -23,8 +23,8 @@ namespace SharedLibrary.Network
static string[] SendQuery(QueryType Type, Server QueryServer, string Parameters = "")
{
var ServerOOBConnection = new UdpClient();
ServerOOBConnection.Client.SendTimeout = 1000;
ServerOOBConnection.Client.ReceiveTimeout = 1000;
ServerOOBConnection.Client.SendTimeout = 5000;
ServerOOBConnection.Client.ReceiveTimeout = 5000;
var Endpoint = new IPEndPoint(IPAddress.Parse(QueryServer.GetIP()), QueryServer.GetPort());
string QueryString = String.Empty;
@ -76,15 +76,16 @@ namespace SharedLibrary.Network
throw e;
}
catch (Exception)
catch (Exception e)
{
attempts++;
if (attempts > 5)
if (attempts > 2)
{
var e = new Exceptions.NetworkException("Could not communicate with the server");
e.Data["server_address"] = ServerOOBConnection.Client.RemoteEndPoint.ToString();
var ne = new Exceptions.NetworkException("Could not communicate with the server");
ne.Data["internal_exception"] = e.Message;
ne.Data["server_address"] = ServerOOBConnection.Client.RemoteEndPoint.ToString();
ServerOOBConnection.Close();
throw e;
throw ne;
}
Thread.Sleep(1000);