aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Net.Http/src/Core/HttpServerBase.cs11
-rw-r--r--lib/Net.Transport.SimpleTCP/src/TCPConfig.cs6
-rw-r--r--lib/Plugins.Essentials.ServiceStack/src/Construction/HttpServiceStackBuilder.cs2
-rw-r--r--lib/Plugins.Essentials.ServiceStack/src/Construction/ServiceBuilder.cs6
-rw-r--r--lib/Utils/src/Memory/MemoryUtil.CopyUtilCore.cs2
-rw-r--r--lib/Utils/src/Memory/MemoryUtil.cs43
-rw-r--r--lib/Utils/src/Memory/UnsafeMemoryHandle.cs4
7 files changed, 35 insertions, 39 deletions
diff --git a/lib/Net.Http/src/Core/HttpServerBase.cs b/lib/Net.Http/src/Core/HttpServerBase.cs
index 0eb5cef..b4fd17d 100644
--- a/lib/Net.Http/src/Core/HttpServerBase.cs
+++ b/lib/Net.Http/src/Core/HttpServerBase.cs
@@ -38,7 +38,7 @@
/*
* 6-26-2024
*
- * Server has been transformed to ultilse a single configuration to listen
+ * Server has been transformed to ultilize a single configuration to listen
* on a map of transport servers and isolate those connections to individual
* virtual hosts. It allows multiple virtual hosts to be mapped to a single
* transport server, but also allow a many-to-many relationship between
@@ -142,7 +142,7 @@ namespace VNLib.Net.Http
KeepAliveTimeoutHeaderValue = $"timeout={(int)_config.ConnectionKeepAlive.TotalSeconds}";
//Map transport listeners to their virtual hosts
- Transports = MapListeners(bindings);
+ Transports = MapListeners(bindings.ToArray());
//Cache supported compression methods, or none if compressor is null
SupportedCompressionMethods = config.CompressorManager == null
@@ -242,8 +242,13 @@ namespace VNLib.Net.Http
}
}
- private static ListenerState[] MapListeners(IEnumerable<HttpTransportBinding> bindings)
+ private static ListenerState[] MapListeners(HttpTransportBinding[] bindings)
{
+ if(bindings.Any(static b => b is null))
+ {
+ throw new ArgumentNullException(nameof(bindings),"Transport bindings containing a null entry.");
+ }
+
/*
* Transform the bindings to individual http listeners
* which also requires a frozen mapping of hostnames to
diff --git a/lib/Net.Transport.SimpleTCP/src/TCPConfig.cs b/lib/Net.Transport.SimpleTCP/src/TCPConfig.cs
index f5c8893..6bf63d1 100644
--- a/lib/Net.Transport.SimpleTCP/src/TCPConfig.cs
+++ b/lib/Net.Transport.SimpleTCP/src/TCPConfig.cs
@@ -86,16 +86,16 @@ namespace VNLib.Net.Transport.Tcp
/// WARNING: Setting this value too low will cause significant CPU overhead and GC load
/// </para>
/// </summary>
- public required readonly int CacheQuota { get; init; }
+ public readonly int CacheQuota { get; init; }
/// <summary>
/// An optional callback invoked after the socket has been created
/// for optional appliction specific socket configuration
/// </summary>
- public required readonly Action<Socket>? OnSocketCreated { get; init; }
+ public readonly Action<Socket>? OnSocketCreated { get; init; }
/// <summary>
/// Enables verbose logging of TCP operations using the <see cref="LogLevel.Verbose"/>
/// level
/// </summary>
- public required readonly bool DebugTcpLog { get; init; }
+ public readonly bool DebugTcpLog { get; init; }
}
} \ No newline at end of file
diff --git a/lib/Plugins.Essentials.ServiceStack/src/Construction/HttpServiceStackBuilder.cs b/lib/Plugins.Essentials.ServiceStack/src/Construction/HttpServiceStackBuilder.cs
index 3240330..34c68bf 100644
--- a/lib/Plugins.Essentials.ServiceStack/src/Construction/HttpServiceStackBuilder.cs
+++ b/lib/Plugins.Essentials.ServiceStack/src/Construction/HttpServiceStackBuilder.cs
@@ -112,7 +112,7 @@ namespace VNLib.Plugins.Essentials.ServiceStack.Construction
) => WithHttp((sgs) => {
HttpTransportBinding[] vhBindings = getBindings(sgs)
- .Select(s =>
+ .Select(static s =>
{
IEnumerable<IWebRoot> procs = s.Hosts.Select(static s => s.Processor);
return new HttpTransportBinding(s.Transport, procs);
diff --git a/lib/Plugins.Essentials.ServiceStack/src/Construction/ServiceBuilder.cs b/lib/Plugins.Essentials.ServiceStack/src/Construction/ServiceBuilder.cs
index 2464d9b..4817ba0 100644
--- a/lib/Plugins.Essentials.ServiceStack/src/Construction/ServiceBuilder.cs
+++ b/lib/Plugins.Essentials.ServiceStack/src/Construction/ServiceBuilder.cs
@@ -3,9 +3,9 @@
*
* Library: VNLib
* Package: VNLib.Plugins.Essentials.ServiceStack
-* File: HttpServiceStackBuilder.cs
+* File: ServiceBuilder.cs
*
-* HttpServiceStackBuilder.cs is part of VNLib.Plugins.Essentials.ServiceStack which is part of the larger
+* ServiceBuilder.cs is part of VNLib.Plugins.Essentials.ServiceStack which is part of the larger
* VNLib collection of libraries and utilities.
*
* VNLib.Plugins.Essentials.ServiceStack is free software: you can redistribute it and/or modify
@@ -55,6 +55,8 @@ namespace VNLib.Plugins.Essentials.ServiceStack.Construction
/// <returns>The current instance for chaining</returns>
public ServiceBuilder AddHostCollection(Action<ICollection<IServiceHost>> host)
{
+ ArgumentNullException.ThrowIfNull(host);
+
_callbacks.Add(host);
return this;
}
diff --git a/lib/Utils/src/Memory/MemoryUtil.CopyUtilCore.cs b/lib/Utils/src/Memory/MemoryUtil.CopyUtilCore.cs
index 9decef7..6899877 100644
--- a/lib/Utils/src/Memory/MemoryUtil.CopyUtilCore.cs
+++ b/lib/Utils/src/Memory/MemoryUtil.CopyUtilCore.cs
@@ -308,4 +308,4 @@ namespace VNLib.Utils.Memory
}
}
}
-} \ No newline at end of file
+}
diff --git a/lib/Utils/src/Memory/MemoryUtil.cs b/lib/Utils/src/Memory/MemoryUtil.cs
index 34489a4..09c36d5 100644
--- a/lib/Utils/src/Memory/MemoryUtil.cs
+++ b/lib/Utils/src/Memory/MemoryUtil.cs
@@ -519,7 +519,8 @@ namespace VNLib.Utils.Memory
/// <param name="target">A pointer to initialized target structure to copy data to</param>
/// <exception cref="ArgumentNullException"></exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void CopyStruct<T>(ref readonly byte source, void* target) where T : unmanaged => CopyStruct(in source, (T*)target);
+ public static void CopyStruct<T>(ref readonly byte source, void* target) where T : unmanaged
+ => CopyStruct(in source, (T*)target);
/// <summary>
/// Copies structure data from a source sequence of data to the target structure reference.
@@ -548,7 +549,8 @@ namespace VNLib.Utils.Memory
/// <param name="target">A pointer to initialized target structure to copy data to</param>
/// <exception cref="ArgumentNullException"></exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void CopyStruct<T>(ReadOnlySpan<byte> sourceData, T* target) where T : unmanaged => CopyStruct(sourceData, ref *target);
+ public static void CopyStruct<T>(ReadOnlySpan<byte> sourceData, T* target) where T : unmanaged
+ => CopyStruct(sourceData, ref *target);
/// <summary>
/// Copies structure data from a source sequence of data to the target structure reference.
@@ -558,7 +560,8 @@ namespace VNLib.Utils.Memory
/// <param name="target">A pointer to initialized target structure to copy data to</param>
/// <exception cref="ArgumentNullException"></exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void CopyStruct<T>(ReadOnlySpan<byte> sourceData, void* target) where T: unmanaged => CopyStruct(sourceData, (T*)target);
+ public static void CopyStruct<T>(ReadOnlySpan<byte> sourceData, void* target) where T: unmanaged
+ => CopyStruct(sourceData, (T*)target);
/// <summary>
@@ -743,7 +746,7 @@ namespace VNLib.Utils.Memory
ref Refs.AsByte(source, (nuint)sourceOffset),
ref Refs.AsByte(dest, destOffset),
ByteCount<T>((uint)count),
- false
+ forceAcceleration: false
);
}
@@ -774,7 +777,7 @@ namespace VNLib.Utils.Memory
RMemCopyHandle<T> src = new(source, (nuint)sourceOffset);
MemhandleCopyHandle<T> dst = new(dest, destOffset);
- MemmoveInternal<T, RMemCopyHandle<T>, MemhandleCopyHandle<T>>(in src, in dst, (nuint)count, false);
+ MemmoveInternal<T, RMemCopyHandle<T>, MemhandleCopyHandle<T>>(in src, in dst, (nuint)count, forceAcceleration: false);
}
/// <summary>
@@ -809,7 +812,7 @@ namespace VNLib.Utils.Memory
ref Refs.AsByte(source, (nuint)sourceOffset),
ref Refs.AsByte(dest, (nuint)destOffset),
ByteCount<T>((uint)count),
- false
+ forceAcceleration: false
);
}
@@ -842,7 +845,7 @@ namespace VNLib.Utils.Memory
MemhandleCopyHandle<T> src = new(source, (nuint)sourceOffset);
WMemCopyHandle<T> dst = new(dest, (nuint)destOffset);
- MemmoveInternal<T, MemhandleCopyHandle<T>, WMemCopyHandle<T>>(in src, in dst, (nuint)count, false);
+ MemmoveInternal<T, MemhandleCopyHandle<T>, WMemCopyHandle<T>>(in src, in dst, (nuint)count, forceAcceleration: false);
}
/// <summary>
@@ -872,7 +875,7 @@ namespace VNLib.Utils.Memory
MemhandleCopyHandle<T> src = new(source, sourceOffset);
MemhandleCopyHandle<T> dst = new(dest, destOffset);
- MemmoveInternal<T, MemhandleCopyHandle<T>, MemhandleCopyHandle<T>>(in src, in dst, count, false);
+ MemmoveInternal<T, MemhandleCopyHandle<T>, MemhandleCopyHandle<T>>(in src, in dst, count, forceAcceleration: false);
}
/// <summary>
@@ -901,7 +904,7 @@ namespace VNLib.Utils.Memory
MemhandleCopyHandle<T> src = new(source, sourceOffset);
ArrayCopyHandle<T> dst = new(dest, destOffset);
- MemmoveInternal<T, MemhandleCopyHandle<T>, ArrayCopyHandle<T>>(in src, in dst, count, false);
+ MemmoveInternal<T, MemhandleCopyHandle<T>, ArrayCopyHandle<T>>(in src, in dst, count, forceAcceleration: false);
}
/// <summary>
@@ -930,7 +933,7 @@ namespace VNLib.Utils.Memory
ArrayCopyHandle<T> ach = new(source, sourceOffset);
MemhandleCopyHandle<T> mch = new(dest, destOffset);
- MemmoveInternal<T, ArrayCopyHandle<T>, MemhandleCopyHandle<T>>(in ach, in mch, count, false);
+ MemmoveInternal<T, ArrayCopyHandle<T>, MemhandleCopyHandle<T>>(in ach, in mch, count, forceAcceleration: false);
}
/// <summary>
@@ -959,7 +962,7 @@ namespace VNLib.Utils.Memory
ArrayCopyHandle<T> srcH = new(source, sourceOffset);
ArrayCopyHandle<T> dstH = new(dest, destOffset);
- MemmoveInternal<T, ArrayCopyHandle<T>, ArrayCopyHandle<T>>(in srcH, in dstH, count, false);
+ MemmoveInternal<T, ArrayCopyHandle<T>, ArrayCopyHandle<T>>(in srcH, in dstH, count, forceAcceleration: false);
}
/// <summary>
@@ -1029,7 +1032,7 @@ namespace VNLib.Utils.Memory
in Refs.AsByteR(in src, srcOffset),
ref Refs.AsByte(ref dst, dstOffset),
ByteCount<T>(elementCount),
- false
+ forceAcceleration: false
);
}
@@ -1332,7 +1335,7 @@ namespace VNLib.Utils.Memory
//Pin the array
GCHandle arrHandle = GCHandle.Alloc(array, GCHandleType.Pinned);
- //safe to get array basee pointer
+ //safe to get array base pointer
ref T arrBase = ref MemoryMarshal.GetArrayDataReference(array);
//Get element offset
@@ -1574,8 +1577,6 @@ namespace VNLib.Utils.Memory
MemoryHandle Pin();
- nuint Size { get; }
-
nuint Offset { get; }
void Validate(nuint count);
@@ -1587,9 +1588,6 @@ namespace VNLib.Utils.Memory
public readonly nuint Offset => offset;
///<inheritdoc/>
- public readonly nuint Size => ByteCount<T>((nuint)array.Length);
-
- ///<inheritdoc/>
public readonly MemoryHandle Pin() => PinArrayAndGetHandle(array, 0);
///<inheritdoc/>
@@ -1605,9 +1603,6 @@ namespace VNLib.Utils.Memory
public readonly nuint Offset => offset;
///<inheritdoc/>
- public readonly nuint Size => ByteCount<T>((nuint)block.Length);
-
- ///<inheritdoc/>
public readonly MemoryHandle Pin() => block.Pin();
///<inheritdoc/>
@@ -1623,9 +1618,6 @@ namespace VNLib.Utils.Memory
public readonly nuint Offset => offset;
///<inheritdoc/>
- public readonly nuint Size => ByteCount<T>((nuint)block.Length);
-
- ///<inheritdoc/>
public readonly MemoryHandle Pin() => block.Pin();
///<inheritdoc/>
@@ -1641,9 +1633,6 @@ namespace VNLib.Utils.Memory
public readonly nuint Offset => offset;
///<inheritdoc/>
- public readonly nuint Size => handle.Length;
-
- ///<inheritdoc/>
public readonly MemoryHandle Pin() => handle.Pin(0);
///<inheritdoc/>
diff --git a/lib/Utils/src/Memory/UnsafeMemoryHandle.cs b/lib/Utils/src/Memory/UnsafeMemoryHandle.cs
index bda8e2e..4041d0b 100644
--- a/lib/Utils/src/Memory/UnsafeMemoryHandle.cs
+++ b/lib/Utils/src/Memory/UnsafeMemoryHandle.cs
@@ -286,7 +286,7 @@ namespace VNLib.Utils.Memory
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns>True if handles are equal, flase otherwise</returns>
- public static bool operator ==(in UnsafeMemoryHandle<T> left, in UnsafeMemoryHandle<T> right) => left.Equals(right);
+ public static bool operator ==(in UnsafeMemoryHandle<T> left, in UnsafeMemoryHandle<T> right) => left.Equals(in right);
/// <summary>
/// Equality overload
@@ -294,7 +294,7 @@ namespace VNLib.Utils.Memory
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns>True if handles are equal, flase otherwise</returns>
- public static bool operator !=(in UnsafeMemoryHandle<T> left, in UnsafeMemoryHandle<T> right) => !left.Equals(right);
+ public static bool operator !=(in UnsafeMemoryHandle<T> left, in UnsafeMemoryHandle<T> right) => !left.Equals(in right);
}
}