From 3f44067a0ce62a312a315e1e549fc4ac8c486e32 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 29 Jan 2020 19:39:51 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/ResponseStream.cs | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/websocket-sharp/Net/ResponseStream.cs b/websocket-sharp/Net/ResponseStream.cs index 1213ba1d..77ab5fe1 100644 --- a/websocket-sharp/Net/ResponseStream.cs +++ b/websocket-sharp/Net/ResponseStream.cs @@ -238,21 +238,27 @@ namespace WebSocketSharp.Net return; _disposed = true; - if (!force && flush (true)) { - _response.Close (); - } - else { - if (_sendChunked) { - var last = getChunkSizeBytes (0, true); - _write (last, 0, last.Length); - } - _body.Dispose (); - _body = null; + if (!force) { + if (flush (true)) { + _response.Close (); + + _response = null; + _stream = null; + + return; + } + } - _response.Abort (); + if (_sendChunked) { + var last = getChunkSizeBytes (0, true); + _write (last, 0, last.Length); } + _body.Dispose (); + _response.Abort (); + + _body = null; _response = null; _stream = null; }