Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions nClam/ClamClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ private async Task SendStreamFileChunksAsync(ReadOnlyMemory<byte> 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;
Expand Down Expand Up @@ -395,5 +395,15 @@ public async Task Shutdown(CancellationToken cancellationToken)
{
await ExecuteClamCommandAsync("SHUTDOWN", cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// Reload the virus databases.
/// </summary>
/// <param name="cancellationToken">cancellation token used for request</param>
public async Task ReloadDb(CancellationToken cancellationToken)
{
await ExecuteClamCommandAsync("RELOAD", cancellationToken).ConfigureAwait(false);
}

}
}
11 changes: 11 additions & 0 deletions nClam/IClamClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,16 @@ public interface IClamClient
/// Shuts down the ClamAV server in an orderly fashion.
/// </summary>
Task Shutdown(CancellationToken cancellationToken);

/// <summary>
/// Reload the virus databases.
/// </summary>
/// <param name="cancellationToken">cancellation token used for request</param>
Task ReloadDb(CancellationToken cancellationToken);

/// <summary>
/// Gets the ClamAV server stats
/// </summary>
Task<string> GetStatsAsync(CancellationToken cancellationToken);
}
}