diff --git a/nClam/ClamClient.cs b/nClam/ClamClient.cs index bfc96e5..5c08cb0 100644 --- a/nClam/ClamClient.cs +++ b/nClam/ClamClient.cs @@ -162,10 +162,10 @@ private async Task SendStreamFileChunksAsync(ReadOnlyMemory sourceData, St while (readByteCount < sourceData.Length) { - var toRead = ((sourceData.Length - readByteCount) > MaxChunkSize ? MaxChunkSize : sourceData.Length - readByteCount); - var readBytes = BitConverter.GetBytes((uint) System.Net.IPAddress.HostToNetworkOrder(toRead)); - - await clamStream.WriteAsync(readBytes, 0, readBytes.Length, cancellationToken).ConfigureAwait(false); + var toRead = ((sourceData.Length - readByteCount) > MaxChunkSize ? MaxChunkSize : sourceData.Length - readByteCount); + var readBytes = BitConverter.GetBytes((uint) System.Net.IPAddress.HostToNetworkOrder(toRead)); + + await clamStream.WriteAsync(readBytes, 0, readBytes.Length, cancellationToken).ConfigureAwait(false); await clamStream.WriteAsync(sourceData.Slice(readByteCount, toRead), cancellationToken).ConfigureAwait(false); readByteCount += toRead; @@ -395,5 +395,15 @@ public async Task Shutdown(CancellationToken cancellationToken) { await ExecuteClamCommandAsync("SHUTDOWN", cancellationToken).ConfigureAwait(false); } + + /// + /// Reload the virus databases. + /// + /// cancellation token used for request + public async Task ReloadDb(CancellationToken cancellationToken) + { + await ExecuteClamCommandAsync("RELOAD", cancellationToken).ConfigureAwait(false); + } + } } diff --git a/nClam/IClamClient.cs b/nClam/IClamClient.cs index edd391e..cd9f20e 100644 --- a/nClam/IClamClient.cs +++ b/nClam/IClamClient.cs @@ -139,5 +139,16 @@ public interface IClamClient /// Shuts down the ClamAV server in an orderly fashion. /// Task Shutdown(CancellationToken cancellationToken); + + /// + /// Reload the virus databases. + /// + /// cancellation token used for request + Task ReloadDb(CancellationToken cancellationToken); + + /// + /// Gets the ClamAV server stats + /// + Task GetStatsAsync(CancellationToken cancellationToken); } } \ No newline at end of file