Melongeed / steam-limiter

Automatically exported from code.google.com/p/steam-limiter
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Monitor and limit Steam bandwidth usage #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
By capturing the Steam client's calls to the recv() API it should be possible 
to measure (to a first approximation, minus TCP overhead) the incoming data 
volume being used by aggregating all the recv() calls.

By taking this data and smoothing it to derive an approximate rate, it should 
be possible to compute a delay factor if the incoming data rate exceeds a 
nominated threshold. This delay can be applied in the recv() hook before 
returning data to the caller.

In principle this could be made per-socket and perhaps tied to the bound peer 
address, but in the first instance this should be useful as a global setting. 
By making it global, some non-download traffic will be included (such as from 
the internal web browser) but that shouldn't be too much of a problem.

By applying the delay once data has arrived it won't be quite as effective as 
true bandwidth limiting, and of course thanks to TCP windowing over a 
long-delay path the applied limit won't be smooth but be somewhat "lumpy", 
although this shouldn't affect the purpose of preventing Steam from completely 
saturating a downlink too badly. It may be necessary to watch out to see 
whether the Steam client requests TCP window scaling or not, though, via 
trapping some more APIs.

Note that this is one of the single most-requested enhancements to Steam there 
is (see http://forums.steampowered.com/forums/showthread.php?t=731183 for just 
one example, threads requesting this appear every few days).

Note that a related concept is simply the tracking of the Steam client's 
aggregate data use persistently, for measuring use over the ISP billing cycle 
as well (although this is less useful now that so many ISPs in countries with 
metered billing are deploying their own unmetered servers).

Original issue reported on code.google.com by nigel.bree@gmail.com on 28 Dec 2011 at 4:30

GoogleCodeExporter commented 8 years ago

Original comment by nigel.bree@gmail.com on 28 Dec 2011 at 4:46