Skip to content

Commit

Permalink
fixed steam web api timeout on win7
Browse files Browse the repository at this point in the history
  • Loading branch information
PredatH0r committed Mar 13, 2017
1 parent 51c864f commit 8022b2d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
10 changes: 8 additions & 2 deletions QueryMaster/QueryMaster/MasterServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,15 @@ public class Response

class XWebClient : WebClient
{
public XWebClient()
{
this.Proxy = null;
}

protected override WebRequest GetWebRequest(Uri address)
{
var req = base.GetWebRequest(address);
req.Timeout = 2000;
req.Timeout = 5000;
return req;
}
}
Expand Down Expand Up @@ -113,7 +118,8 @@ public void GetAddresses(Region region, MasterIpCallback callback, IpFilter filt
using (var cli = new XWebClient())
{
var filters = MasterUtil.ProcessFilter(filter);
var xml = cli.DownloadString($"https://api.steampowered.com/IGameServersService/GetServerList/v1/?key={SteamWebApiKey}&format=xml&filter={filters}&limit={GetAddressesLimit}");
var url = $"https://api.steampowered.com/IGameServersService/GetServerList/v1/?key={SteamWebApiKey}&format=xml&filter={filters}&limit={GetAddressesLimit}";
var xml = cli.DownloadString(url);
var ser = new XmlSerializer(typeof (Response));
var resp = (Response) ser.Deserialize(new StringReader(xml));
Expand Down
21 changes: 20 additions & 1 deletion ServerBrowser/Games/Toxikk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ public override object GetServerCellValue(ServerRow row, string fieldName)
gt == "TTGame" ? "TR" :
gt == "D2DGame" ? "2D" :
gt =="STBGame" ? "SB" :
gt == "Comp2v2" ? "2v2" :
gt == "Comp4v4" ? "4v4" :
gt;
}
case Mutators:
Expand Down Expand Up @@ -232,6 +234,23 @@ public override bool IsValidPlayer(ServerRow server, Player player)
}
#endregion

#region GetMaxPlayers()
public override int? GetMaxPlayers(ServerRow row)
{
var val = row.GetRule("NumPublicConnections");
if (val != null)
return int.Parse(val);
return base.GetMaxPlayers(row);
}
#endregion

#region GetPrivateClients()
public override int? GetPrivateClients(ServerRow row)
{
return row.ServerInfo.MaxPlayers - (GetMaxPlayers(row) ?? 0);
}
#endregion

#region GetBestPlayerSC()
private decimal GetBestPlayerSC(ServerRow row)
{
Expand Down Expand Up @@ -466,7 +485,7 @@ private void UpdatePlayerInfos(ServerRow server)
if (string.IsNullOrEmpty(strNames))
return;
var gameType = (string)server.GetExtenderCellValue("_gametype");
bool isTeamGame = gameType != "BL";
bool isTeamGame = "SA,CC,AD,TA,SB,IB,2v2,4v4".Contains(gameType);
var strSteamIds = (server.GetRule("p1073741829") ?? "") + (server.GetRule("p1073741830") ?? "") + (server.GetRule("p1073741831") ?? "");
var strSkill = server.GetRule("p1073741837") ?? "";
var strRank = server.GetRule("p1073741838") ?? "";
Expand Down
4 changes: 2 additions & 2 deletions ServerBrowser/ServerBrowserForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace ServerBrowser
{
public partial class ServerBrowserForm : XtraForm
{
private const string Version = "2.40";
private const string Version = "2.42";
private const string DevExpressVersion = "v15.2";
private const string CustomDetailColumnPrefix = "ServerInfo.";
private const string CustomRuleColumnPrefix = "custRule.";
Expand Down Expand Up @@ -2260,7 +2260,7 @@ private void gvPlayers_RowCellStyle(object sender, RowCellStyleEventArgs e)
return;
var player = (Player)this.gvPlayers.GetRow(e.RowHandle);
var server = (ServerRow)this.gvServers.GetFocusedRow();
if (!server.GameExtension.IsValidPlayer(server, player))
if (server != null && !server.GameExtension.IsValidPlayer(server, player))
e.Appearance.ForeColor = Color.Silver;
}
#endregion
Expand Down
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2.42
---
- fixed steam master server timeout on Win 7

2.41
---
- TOXIKK: players in ArchRival game mode no longer show up as team Red
- fixed exception when hovering over a player and there is no selected server row

2.40
---
- TOXIKK: auto-detect if steam sockets are supported by the server and if not, use IP:port to join the server
Expand Down

0 comments on commit 8022b2d

Please sign in to comment.