fix memory leak, try something different for metrics

This commit is contained in:
Stanley Dimant
2022-08-04 12:56:01 +02:00
parent 0dc4436ba3
commit 95586549e5
2 changed files with 4 additions and 2 deletions

View File

@@ -174,7 +174,8 @@ namespace MareSynchronosServer.Hubs
{ {
var decodedFile = LZ4.LZ4Codec.Unwrap(uploadedFile.ToArray()); var decodedFile = LZ4.LZ4Codec.Unwrap(uploadedFile.ToArray());
using var sha1 = SHA1.Create(); using var sha1 = SHA1.Create();
var computedHash = await sha1.ComputeHashAsync(new MemoryStream(decodedFile)); using var ms = new MemoryStream(decodedFile);
var computedHash = await sha1.ComputeHashAsync(ms);
var computedHashString = BitConverter.ToString(computedHash).Replace("-", ""); var computedHashString = BitConverter.ToString(computedHash).Replace("-", "");
if (hash != computedHashString) if (hash != computedHashString)
{ {

View File

@@ -114,7 +114,8 @@ namespace MareSynchronosServer
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();
app.UseMetricServer(4980); var metricServer = new KestrelMetricServer(4980);
metricServer.Start();
app.UseStaticFiles(new StaticFileOptions() app.UseStaticFiles(new StaticFileOptions()
{ {