Snapshot for release 2026.10.19.1 (internal fa7a8f6)

This commit is contained in:
Tom Bohar 2026-10-19 09:11:20 -04:00
commit 44074df011
110 changed files with 8017 additions and 291 deletions

View file

@ -116,6 +116,39 @@ internal static class LogPaths
}
}
/// <summary>The shared native crash log every client appends to (see <see cref="RotateNativeCrashLogAtStartup"/>).</summary>
internal const string NativeCrashLogName = "native-crash.log";
/// <summary>A native-crash.log larger than this is moved aside when a client starts.</summary>
internal const long NativeCrashLogRotateBytes = 1L * 1024 * 1024;
/// <summary>
/// Engine-startup rotation of the SHARED native-crash.log (one fixed name for every client,
/// so <see cref="RotateAtStartup"/>'s per-PID rule does not cover it). Over
/// <see cref="NativeCrashLogRotateBytes"/> it moves to native-crash.log.old (replacing the
/// previous one). Must run BEFORE the native logger opens the file. A client that already has
/// it open (they open it share-delete) keeps writing to the moved file, which the logger's
/// own byte budget keeps bounded; nothing is lost, it just continues in the .old file.
/// Best-effort; never throws. Returns true when it moved the file.
/// </summary>
internal static bool RotateNativeCrashLogAtStartup()
{
try
{
string active = Path.Combine(LogDirectory, NativeCrashLogName);
if (!File.Exists(active)) return false;
if (new FileInfo(active).Length < NativeCrashLogRotateBytes) return false;
string rotated = active + ".old";
try { if (File.Exists(rotated)) File.Delete(rotated); } catch { }
File.Move(active, rotated);
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Startup housekeeping: delete per-client session logs (and their .old
/// rotations) older than <see cref="MaxLogAge"/>. Each client launch produces a