Improve XML documentation coverage across src modules and sync generated analysis artifacts.

This commit is contained in:
Joseph Doherty
2026-03-14 03:56:58 -04:00
parent ba0d65317a
commit 46ead5ea9f
152 changed files with 2821 additions and 11284 deletions

View File

@@ -6,11 +6,21 @@ public sealed class AcceptLoopErrorHandler
{
private readonly Action<Exception, EndPoint?, TimeSpan> _callback;
/// <summary>
/// Creates an accept-loop error callback adapter.
/// </summary>
/// <param name="callback">Callback invoked with exception, endpoint, and retry delay.</param>
public AcceptLoopErrorHandler(Action<Exception, EndPoint?, TimeSpan> callback)
{
_callback = callback ?? throw new ArgumentNullException(nameof(callback));
}
/// <summary>
/// Forwards an accept-loop failure event to the configured callback.
/// </summary>
/// <param name="ex">Accept exception.</param>
/// <param name="endpoint">Listener endpoint associated with the accept loop.</param>
/// <param name="delay">Computed delay before the next accept attempt.</param>
public void OnAcceptError(Exception ex, EndPoint? endpoint, TimeSpan delay)
{
_callback(ex, endpoint, delay);

View File

@@ -14,11 +14,18 @@ public sealed class RateCounter
private readonly TimeSpan _interval = TimeSpan.FromSeconds(1);
private readonly Lock _mu = new();
/// <summary>
/// Creates a one-second rate counter with the given allow limit.
/// </summary>
/// <param name="limit">Maximum allowed operations per one-second interval.</param>
public RateCounter(long limit)
{
_limit = Math.Max(1, limit);
}
/// <summary>
/// Attempts to consume one operation slot in the current interval.
/// </summary>
public bool Allow()
{
var now = DateTime.UtcNow;
@@ -42,6 +49,9 @@ public sealed class RateCounter
}
}
/// <summary>
/// Returns and resets the number of blocked attempts since last call.
/// </summary>
public ulong CountBlocked()
{
lock (_mu)

View File

@@ -16,6 +16,8 @@ public static class ServerUtilities
/// Parse a host/port string with a default port fallback.
/// Mirrors util.go parseHostPort behavior where 0/-1 port values fall back.
/// </summary>
/// <param name="hostPort">Host or host:port text from server configuration.</param>
/// <param name="defaultPort">Default port used when input omits or uses 0/-1.</param>
public static (string Host, int Port) ParseHostPort(string hostPort, int defaultPort)
{
if (string.IsNullOrWhiteSpace(hostPort))
@@ -63,6 +65,7 @@ public static class ServerUtilities
/// <summary>
/// Redacts password in a single URL user-info section.
/// </summary>
/// <param name="url">URL that may contain <c>user:password@</c> credentials.</param>
public static string RedactUrlString(string url)
{
var match = UrlAuthRegex.Match(url);
@@ -75,6 +78,7 @@ public static class ServerUtilities
/// <summary>
/// Redacts URL credentials for a URL list.
/// </summary>
/// <param name="urls">URLs to redact before logging or diagnostics output.</param>
public static IReadOnlyList<string> RedactUrlList(IEnumerable<string> urls)
{
return urls.Select(RedactUrlString).ToArray();