aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-01-14 16:33:37 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2023-01-14 16:33:37 -0500
commit0e38da4b583f0227beca3a3f870c395f152c507a (patch)
treee4afcff6390ef2d4528ab4c16bc4c328f8607e56
parent509ecc7ee4f6cd1d85e10c1e3f7e8303edbd94ae (diff)
Utils updates
-rw-r--r--lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs2
-rw-r--r--plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs4
-rw-r--r--plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs4
-rw-r--r--plugins/ObjectCacheServer/src/ObjectCacheServerEntry.cs2
4 files changed, 7 insertions, 5 deletions
diff --git a/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs b/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs
index a34e611..bfab83e 100644
--- a/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs
+++ b/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs
@@ -105,7 +105,7 @@ namespace VNLib.Plugins.Extensions.VNCache
Uri brokerUri = new(brokerAddress);
//Init the client with default settings
- FBMClientConfig conf = FBMDataCacheExtensions.GetDefaultConfig(ClientHeap ?? Memory.Shared, maxMessageSize, DebugLog);
+ FBMClientConfig conf = FBMDataCacheExtensions.GetDefaultConfig(ClientHeap ?? MemoryUtil.Shared, maxMessageSize, DebugLog);
_client = new(conf);
diff --git a/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs b/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs
index 7867e97..c2e0b84 100644
--- a/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs
+++ b/plugins/CacheBroker/src/Endpoints/BrokerRegistrationEndpoint.cs
@@ -200,8 +200,10 @@ namespace VNLib.Plugins.Cache.Broker.Endpoints
{
//get a buffer to store data in
using VnMemoryStream buffer = new();
+
//Copy input stream to buffer
- await inputStream.CopyToAsync(buffer, 4096, Memory.Shared);
+ await inputStream.CopyToAsync(buffer, 4096, MemoryUtil.Shared);
+
//Parse jwt
return JsonWebToken.ParseRaw(buffer.AsSpan());
}
diff --git a/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs b/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs
index 2fe0994..15cc086 100644
--- a/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs
+++ b/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs
@@ -171,7 +171,7 @@ namespace VNLib.Plugins.Essentials.Sessions.Server.Endpoints
auth.WriteHeader(cert.JwtHeader);
auth.InitPayloadClaim()
.AddClaim("aud", AudienceLocalServerId)
- .AddClaim("exp", DateTimeOffset.UtcNow.Add(AuthTokenExpiration).ToUnixTimeSeconds())
+ .AddClaim("exp", entity.RequestedTimeUtc.Add(AuthTokenExpiration).ToUnixTimeSeconds())
.AddClaim("nonce", RandomHash.GetRandomBase32(8))
.AddClaim("chl", challenge!)
//Set the ispeer flag if the request was signed by a cache server
@@ -279,7 +279,7 @@ namespace VNLib.Plugins.Essentials.Sessions.Server.Endpoints
}
if (!doc.RootElement.TryGetProperty("exp", out JsonElement expEl)
- || DateTimeOffset.FromUnixTimeSeconds(expEl.GetInt64()) < DateTimeOffset.UtcNow)
+ || DateTimeOffset.FromUnixTimeSeconds(expEl.GetInt64()) < entity.RequestedTimeUtc)
{
entity.CloseResponse(HttpStatusCode.Unauthorized);
return VfReturnType.VirtualSkip;
diff --git a/plugins/ObjectCacheServer/src/ObjectCacheServerEntry.cs b/plugins/ObjectCacheServer/src/ObjectCacheServerEntry.cs
index 85a7996..7b7b9fb 100644
--- a/plugins/ObjectCacheServer/src/ObjectCacheServerEntry.cs
+++ b/plugins/ObjectCacheServer/src/ObjectCacheServerEntry.cs
@@ -74,7 +74,7 @@ namespace VNLib.Plugins.Essentials.Sessions.Server
protected override void OnLoad()
{
//Create default heap
- IUnmangedHeap CacheHeap = Memory.InitializeNewHeapForProcess();
+ IUnmangedHeap CacheHeap = MemoryUtil.InitializeNewHeapForProcess();
try
{
IReadOnlyDictionary<string, JsonElement> clusterConf = this.GetConfig("cluster");