Skip to content

Commit

Permalink
back to old using and use the underline stream after disposing the gz…
Browse files Browse the repository at this point in the history
…ip tream
  • Loading branch information
dudikeleti committed Jan 16, 2025
1 parent d66bc17 commit fed6099
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tracer/src/Datadog.Trace/Debugger/Upload/SymbolUploadApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,24 @@ public override async Task<bool> SendBatchAsync(ArraySegment<byte> symbols)

MultipartFormItem symbolsItem;

if (_enableCompression)
if (!this._enableCompression)
{
symbolsItem = new MultipartFormItem("file", MimeTypes.Json, "file.json", symbols);
}
else
{
using var memoryStream = new MemoryStream();
#if NETFRAMEWORK
using var gzipStream = new Vendors.ICSharpCode.SharpZipLib.GZip.GZipOutputStream(memoryStream);
await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false);
await gzipStream.FlushAsync().ConfigureAwait(false);
using (var gzipStream = new Vendors.ICSharpCode.SharpZipLib.GZip.GZipOutputStream(memoryStream))
#else
using var gzipStream = new GZipStream(memoryStream, CompressionMode.Compress);
await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false);
await gzipStream.FlushAsync().ConfigureAwait(false);
using (var gzipStream = new GZipStream(memoryStream, CompressionMode.Compress))
#endif
{
await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false);
}

symbolsItem = new MultipartFormItem("file", MimeTypes.Gzip, "file.gz", new ArraySegment<byte>(memoryStream.ToArray()));
}
else
{
symbolsItem = new MultipartFormItem("file", MimeTypes.Json, "file.json", symbols);
}

var items = new[] { symbolsItem, new MultipartFormItem("event", MimeTypes.Json, "event.json", _eventMetadata) };

Expand Down

0 comments on commit fed6099

Please sign in to comment.