From f57575471846e13060f5f01be8dc6c5ffcb905d2 Mon Sep 17 00:00:00 2001 From: vnugent Date: Sat, 25 Feb 2023 21:08:27 -0500 Subject: Project meta + core features and upgrades --- lib/Plugins.Essentials/src/Sessions/SessionHandle.cs | 19 ++++++++++++++----- .../src/VNLib.Plugins.Essentials.csproj | 4 ++-- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'lib/Plugins.Essentials/src') diff --git a/lib/Plugins.Essentials/src/Sessions/SessionHandle.cs b/lib/Plugins.Essentials/src/Sessions/SessionHandle.cs index 15c2743..8dbb077 100644 --- a/lib/Plugins.Essentials/src/Sessions/SessionHandle.cs +++ b/lib/Plugins.Essentials/src/Sessions/SessionHandle.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2022 Vaughn Nugent +* Copyright (c) 2023 Vaughn Nugent * * Library: VNLib * Package: VNLib.Plugins.Essentials @@ -32,6 +32,12 @@ using VNLib.Net.Http; namespace VNLib.Plugins.Essentials.Sessions { + /// + /// The callback method signature used to release attached sessions + /// + /// The session being released + /// The connection the session is attached to + /// A value task that resolves when the session has been released from the connection public delegate ValueTask SessionReleaseCallback(ISession session, IHttpEvent @event); /// @@ -47,6 +53,9 @@ namespace VNLib.Plugins.Essentials.Sessions private readonly SessionReleaseCallback? ReleaseCb; + /// + /// True when a valid session is held by the current handle + /// internal readonly bool IsSet => SessionData != null; /// @@ -83,7 +92,7 @@ namespace VNLib.Plugins.Essentials.Sessions /// Releases the session from use /// /// The current connection event object - public ValueTask ReleaseAsync(IHttpEvent @event) => ReleaseCb?.Invoke(SessionData!, @event) ?? ValueTask.CompletedTask; + public readonly ValueTask ReleaseAsync(IHttpEvent @event) => ReleaseCb?.Invoke(SessionData!, @event) ?? ValueTask.CompletedTask; /// /// Determines if another is equal to the current handle. @@ -91,15 +100,15 @@ namespace VNLib.Plugins.Essentials.Sessions /// /// The other handle to /// true if neither handle is set or if their SessionData object is equal, false otherwise - public bool Equals(SessionHandle other) + public readonly bool Equals(SessionHandle other) { //If neither handle is set, then they are equal, otherwise they are equal if the session objects themselves are equal return (!IsSet && !other.IsSet) || (SessionData?.Equals(other.SessionData) ?? false); } /// - public override bool Equals([NotNullWhen(true)] object? obj) => (obj is SessionHandle other) && Equals(other); + public readonly override bool Equals([NotNullWhen(true)] object? obj) => (obj is SessionHandle other) && Equals(other); /// - public override int GetHashCode() + public readonly override int GetHashCode() { return IsSet ? SessionData!.GetHashCode() : base.GetHashCode(); } diff --git a/lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj b/lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj index 1fa6264..fd558ec 100644 --- a/lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj +++ b/lib/Plugins.Essentials/src/VNLib.Plugins.Essentials.csproj @@ -21,9 +21,9 @@ Provides essential web, sessions, users abstractions for building extensable web applications with satefull sessions, user based intraction with login and account security extensions. - https://www.vaughnnugent.com/resources/software + https://www.vaughnnugent.com/resources/software/modules/VNLib.Core VNLib, Plugins, VNLib.Plugins.Essentials, Essentials, Essential Plugins, HTTP Essentials, OAuth2 - https://github.com/VnUgE/VNLib.Core + https://github.com/VnUgE/VNLib.Core/tree/main/lib/Plugins.Essentials -- cgit