diff options
Diffstat (limited to 'Plugins')
5 files changed, 13 insertions, 16 deletions
diff --git a/Plugins/CacheBroker/Endpoints/BrokerRegistrationEndpoint.cs b/Plugins/CacheBroker/Endpoints/BrokerRegistrationEndpoint.cs index 06ebfc3..14e2ba6 100644 --- a/Plugins/CacheBroker/Endpoints/BrokerRegistrationEndpoint.cs +++ b/Plugins/CacheBroker/Endpoints/BrokerRegistrationEndpoint.cs @@ -14,7 +14,7 @@ using System.Text.Json.Serialization; using RestSharp; -using VNLib.Net; +using VNLib.Net.Http; using VNLib.Utils; using VNLib.Utils.IO; using VNLib.Utils.Memory; @@ -26,7 +26,6 @@ using VNLib.Plugins.Essentials.Endpoints; using VNLib.Plugins.Essentials.Extensions; using VNLib.Plugins.Extensions.Loading; using VNLib.Plugins.Extensions.Loading.Events; -using VNLib.Plugins.Extensions.Loading.Configuration; using VNLib.Net.Rest.Client; #nullable enable @@ -122,13 +121,13 @@ namespace VNLib.Plugins.Cache.Broker.Endpoints protected override async ValueTask<VfReturnType> PostAsync(HttpEntity entity) { //Parse jwt - using JsonWebToken? jwt = await entity.ParseFileAsAsync(ParseJwtAsync); + using JsonWebToken jwt = await entity.ParseFileAsAsync(ParseJwtAsync) ?? throw new Exception("Invalid JWT"); //Verify with the client's pub key using (ECDsa alg = ECDsa.Create(DefaultCurve)) { alg.ImportSubjectPublicKeyInfo(ClientPubKey.Result, out _); //Verify with client public key - if (!jwt.Verify(alg, SignatureHashAlg)) + if (!jwt.Verify(alg, in SignatureHashAlg)) { entity.CloseResponse(HttpStatusCode.Unauthorized); return VfReturnType.VirtualSkip; @@ -304,7 +303,7 @@ namespace VNLib.Plugins.Cache.Broker.Endpoints * Schedule heartbeat interval */ [ConfigurableAsyncInterval("heartbeat_sec", IntervalResultionType.Seconds)] - public async Task OnIntervalAsync(BrokerRegistrationEndpoint bep, CancellationToken pluginExit) + public async Task OnIntervalAsync(ILogProvider log, CancellationToken pluginExit) { ActiveServer[] servers; //Get the current list of active servers @@ -312,11 +311,11 @@ namespace VNLib.Plugins.Cache.Broker.Endpoints { servers = ActiveServers.Values.ToArray(); } - List<Task> all = new(); + LinkedList<Task> all = new(); //Run keeplaive request for all active servers foreach (ActiveServer server in servers) { - all.Add(RunHeartbeatAsync(server)); + all.AddLast(RunHeartbeatAsync(server)); } //Wait for all to complete await Task.WhenAll(all); @@ -356,7 +355,7 @@ namespace VNLib.Plugins.Cache.Broker.Endpoints keepaliveRequest.AddHeader("Authorization", authMessage); //Rent client from pool - using ClientContract client = await ClientPool.GetClientAsync(); + using ClientContract client = ClientPool.Lease(); //Exec RestResponse response = await client.Resource.ExecuteAsync(keepaliveRequest); //If the response was successful, then keep it in the list, if the response fails, diff --git a/Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs b/Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs index 0385601..bb5fcac 100644 --- a/Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs +++ b/Plugins/SessionCacheServer/Endpoints/ConnectEndpoint.cs @@ -22,7 +22,7 @@ using VNLib.Plugins.Essentials.Endpoints; using VNLib.Plugins.Essentials.Extensions; -namespace VNLib.Plugins.Essentials.Sessions.Server +namespace VNLib.Plugins.Essentials.Sessions.Server.Endpoints { class ConnectEndpoint : ResourceEndpointBase { @@ -95,8 +95,8 @@ namespace VNLib.Plugins.Essentials.Sessions.Server } } catch (OperationCanceledException) - {} - catch(Exception ex) + { } + catch (Exception ex) { Log.Error(ex); } @@ -107,7 +107,7 @@ namespace VNLib.Plugins.Essentials.Sessions.Server public int RecvBufferSize { get; init; } public int MaxHeaderBufferSize { get; init; } public int MaxMessageSize { get; init; } - public int MaxResponseBufferSize { get; init; } + public int MaxResponseBufferSize { get; init; } public AsyncQueue<ChangeEvent>? SyncQueue { get; init; } } @@ -207,7 +207,7 @@ namespace VNLib.Plugins.Essentials.Sessions.Server try { WsUserState state = (wss.UserState as WsUserState)!; - + //Init listener args from request FBMListenerSessionParams args = new() { diff --git a/Plugins/SessionCacheServer/SessionCacheServer.csproj b/Plugins/SessionCacheServer/SessionCacheServer.csproj index 8c45a24..580bac3 100644 --- a/Plugins/SessionCacheServer/SessionCacheServer.csproj +++ b/Plugins/SessionCacheServer/SessionCacheServer.csproj @@ -36,7 +36,6 @@ <ProjectReference Include="..\..\..\..\VNLib\Essentials\VNLib.Plugins.Essentials.csproj" /> <ProjectReference Include="..\..\..\DataCaching\VNLib.Data.Caching.Extensions\VNLib.Data.Caching.Extensions.csproj" /> <ProjectReference Include="..\..\..\DataCaching\VNLib.Data.Caching.ObjectCache\VNLib.Data.Caching.ObjectCache.csproj" /> - <ProjectReference Include="..\..\..\Extensions\VNLib.Plugins.Extensions.Loading\VNLib.Plugins.Extensions.Loading.csproj" /> <ProjectReference Include="..\..\..\PluginBase\VNLib.Plugins.PluginBase.csproj" /> <ProjectReference Include="..\CacheBroker\CacheBroker.csproj" /> </ItemGroup> diff --git a/Plugins/SessionCacheServer/SessionServerEntrypoint.cs b/Plugins/SessionCacheServer/SessionServerEntrypoint.cs index 45c5da2..4d00c8d 100644 --- a/Plugins/SessionCacheServer/SessionServerEntrypoint.cs +++ b/Plugins/SessionCacheServer/SessionServerEntrypoint.cs @@ -25,10 +25,8 @@ using VNLib.Net.Messaging.FBM.Client; using VNLib.Plugins.Cache.Broker.Endpoints; using VNLib.Plugins.Extensions.Loading; using VNLib.Plugins.Extensions.Loading.Routing; -using VNLib.Plugins.Extensions.Loading.Configuration; using VNLib.Plugins.Essentials.Sessions.Server.Endpoints; - namespace VNLib.Plugins.Essentials.Sessions.Server { public sealed class SessionServerEntrypoint : PluginBase diff --git a/Plugins/SessionProvider/SessionClientEntryPoint.cs b/Plugins/SessionProvider/SessionClientEntryPoint.cs index 07be1ef..ed62d4c 100644 --- a/Plugins/SessionProvider/SessionClientEntryPoint.cs +++ b/Plugins/SessionProvider/SessionClientEntryPoint.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using VNLib.Net.Http; using VNLib.Utils.Logging; using VNLib.Plugins.Extensions.Loading; +using VNLib.Plugins.Essentials.Sessions.Runtime; namespace VNLib.Plugins.Essentials.Sessions { |