Publish Zonghengjia Windows 0.3.20 client source
This commit is contained in:
+11
-5
@@ -273,7 +273,11 @@ internal sealed class XrayManager : IDisposable, IAsyncDisposable, IHandoverRunt
|
||||
Task.WhenAll(new[] { "chatgpt.com", "api.openai.com", "www.google.com" }.Select(target =>
|
||||
ScheduleLearningAsync(new LearningObservation { Target=target, Port=443, AccessKind="http",
|
||||
Node=_nodeSlug, Scope=PrivateAuxiliaryRuntime.IsPrivate(_baseConfigJson ?? "{}") ? "private_auxiliary" : "public" }, warmupToken))),
|
||||
cancellationToken);
|
||||
cancellationToken,
|
||||
onBackgroundCompleted: error => AppPaths.WriteLog(new TransportDiagnostic(
|
||||
"connection_phase", error is null ? "learning_finished_or_cancelled" : "learning_failed_observed",
|
||||
_nodeSlug).SafeMessage));
|
||||
AppPaths.WriteLog(new TransportDiagnostic("connection_phase", "runtime_ready", _nodeSlug).SafeMessage);
|
||||
}
|
||||
|
||||
internal async Task StopAsync()
|
||||
@@ -642,7 +646,8 @@ internal sealed class XrayManager : IDisposable, IAsyncDisposable, IHandoverRunt
|
||||
&& !value.Contains("Failed to start", StringComparison.OrdinalIgnoreCase)) return;
|
||||
try
|
||||
{
|
||||
File.AppendAllText(AppPaths.XrayLogFile, $"{DateTimeOffset.Now:O} {value}{Environment.NewLine}");
|
||||
BoundedLog.Append(AppPaths.XrayLogFile, $"{DateTimeOffset.Now:O} {value}{Environment.NewLine}",
|
||||
BoundedLog.XrayMaxBytes);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
@@ -704,9 +709,10 @@ internal sealed class XrayManager : IDisposable, IAsyncDisposable, IHandoverRunt
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(AppPaths.XrayLogFile)) return "";
|
||||
var lines = File.ReadLines(AppPaths.XrayLogFile).TakeLast(3);
|
||||
return $" {string.Join(" ", lines)}";
|
||||
var tail = BoundedLog.ReadTail(AppPaths.XrayLogFile, 3, BoundedLog.ErrorTailMaxBytes);
|
||||
return string.IsNullOrWhiteSpace(tail.Text)
|
||||
? ""
|
||||
: $" {tail.Text.Replace(Environment.NewLine, " ", StringComparison.Ordinal)}";
|
||||
}
|
||||
catch { return ""; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user