Skip to content

Commit

Permalink
dispose controller
Browse files Browse the repository at this point in the history
  • Loading branch information
campersau committed Aug 30, 2023
1 parent cdfeab2 commit e2193e6
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,20 @@ private static async Task<WasmFetchResponse> CallFetch(HttpRequestMessage reques
view = buffer ??= new byte[65536];
}

try
using (controller)
{
int length = await stream.ReadAsync(view, cancellationToken).ConfigureAwait(true);
using (Buffers.MemoryHandle handle = view.Pin())
try
{
ReadableStreamControllerEnqueueUnsafe(controller, handle, length);
int length = await stream.ReadAsync(view, cancellationToken).ConfigureAwait(true);
using (Buffers.MemoryHandle handle = view.Pin())
{
ReadableStreamControllerEnqueueUnsafe(controller, handle, length);
}
}
catch (Exception ex)
{
BrowserHttpInterop.ReadableStreamControllerError(controller, ex);
}
}
catch (Exception ex)
{
BrowserHttpInterop.ReadableStreamControllerError(controller, ex);
}
};

Expand Down

0 comments on commit e2193e6

Please sign in to comment.