2.4.2: Added HTTP diagnostics to -debug

pull/225/head DepotDownloader_2.4.2
Ryan Kistner 4 years ago
parent 4b0cbb06dc
commit 3c5ed59b2e

@ -840,8 +840,11 @@ namespace DepotDownloader
try
{
connection = cdnPool.GetConnection(cts.Token);
DebugLog.WriteLine("ContentDownloader", "Authenticating connection to {0}", connection);
var cdnToken = await cdnPool.AuthenticateConnection(appId, depot.id, connection);
DebugLog.WriteLine("ContentDownloader", "Downloading manifest {0} from {1} with {2}", depot.manifestId, connection, cdnPool.ProxyServer != null ? cdnPool.ProxyServer : "no proxy");
depotManifest = await cdnPool.CDNClient.DownloadManifestAsync(depot.id, depot.manifestId,
connection, cdnToken, depot.depotKey, proxyServer: cdnPool.ProxyServer).ConfigureAwait(false);
@ -1215,8 +1218,11 @@ namespace DepotDownloader
try
{
connection = cdnPool.GetConnection(cts.Token);
DebugLog.WriteLine("ContentDownloader", "Authenticating connection to {0}", connection);
var cdnToken = await cdnPool.AuthenticateConnection(appId, depot.id, connection);
DebugLog.WriteLine("ContentDownloader", "Downloading chunk {0} from {1} with {2}", chunkID, connection, cdnPool.ProxyServer != null ? cdnPool.ProxyServer : "no proxy");
chunkData = await cdnPool.CDNClient.DownloadDepotChunkAsync(depot.id, data,
connection, cdnToken, depot.depotKey, proxyServer: cdnPool.ProxyServer).ConfigureAwait(false);

@ -0,0 +1,42 @@
using System;
using System.Diagnostics.Tracing;
using System.Text;
namespace DepotDownloader
{
internal sealed class HttpDiagnosticEventListener : EventListener
{
public const EventKeywords TasksFlowActivityIds = (EventKeywords)0x80;
protected override void OnEventSourceCreated(EventSource eventSource)
{
if (eventSource.Name == "System.Net.Http" ||
eventSource.Name == "System.Net.Sockets" ||
eventSource.Name == "System.Net.Security" ||
eventSource.Name == "System.Net.NameResolution")
{
EnableEvents(eventSource, EventLevel.LogAlways);
}
else if (eventSource.Name == "System.Threading.Tasks.TplEventSource")
{
EnableEvents(eventSource, EventLevel.LogAlways, TasksFlowActivityIds);
}
}
protected override void OnEventWritten(EventWrittenEventArgs eventData)
{
var sb = new StringBuilder().Append($"{eventData.TimeStamp:HH:mm:ss.fffffff} {eventData.EventSource.Name}.{eventData.EventName}(");
for (int i = 0; i < eventData.Payload?.Count; i++)
{
sb.Append(eventData.PayloadNames?[i]).Append(": ").Append(eventData.Payload[i]);
if (i < eventData.Payload?.Count - 1)
{
sb.Append(", ");
}
}
sb.Append(")");
Console.WriteLine(sb.ToString());
}
}
}

@ -5,7 +5,6 @@ using System.Text.RegularExpressions;
using SteamKit2;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Linq;
namespace DepotDownloader
@ -36,6 +35,8 @@ namespace DepotDownloader
{
Console.WriteLine( "[{0}] {1}", category, message );
});
var httpEventListener = new HttpDiagnosticEventListener();
}
string username = GetParameter<string>( args, "-username" ) ?? GetParameter<string>( args, "-user" );

@ -31,4 +31,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.1.0")]
[assembly: AssemblyVersion("2.4.2.0")]

Loading…
Cancel
Save