[Modify] Rename it
This commit is contained in:
parent
7cf6b82177
commit
8afac96d6d
@ -47,7 +47,7 @@ namespace WebSocketSharp.Net
|
|||||||
{
|
{
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
private MemoryStream _body;
|
private MemoryStream _bodyBuffer;
|
||||||
private static readonly byte[] _crlf;
|
private static readonly byte[] _crlf;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
private Stream _innerStream;
|
private Stream _innerStream;
|
||||||
@ -90,7 +90,7 @@ namespace WebSocketSharp.Net
|
|||||||
_writeChunked = writeChunked;
|
_writeChunked = writeChunked;
|
||||||
}
|
}
|
||||||
|
|
||||||
_body = new MemoryStream ();
|
_bodyBuffer = new MemoryStream ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -155,18 +155,18 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
private void flushBody (bool closing)
|
private void flushBody (bool closing)
|
||||||
{
|
{
|
||||||
using (_body) {
|
using (_bodyBuffer) {
|
||||||
var len = _body.Length;
|
var len = _bodyBuffer.Length;
|
||||||
|
|
||||||
if (len > Int32.MaxValue) {
|
if (len > Int32.MaxValue) {
|
||||||
_body.Position = 0;
|
_bodyBuffer.Position = 0;
|
||||||
|
|
||||||
var buffLen = 1024;
|
var buffLen = 1024;
|
||||||
var buff = new byte[buffLen];
|
var buff = new byte[buffLen];
|
||||||
var nread = 0;
|
var nread = 0;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
nread = _body.Read (buff, 0, buffLen);
|
nread = _bodyBuffer.Read (buff, 0, buffLen);
|
||||||
|
|
||||||
if (nread <= 0)
|
if (nread <= 0)
|
||||||
break;
|
break;
|
||||||
@ -175,25 +175,25 @@ namespace WebSocketSharp.Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (len > 0) {
|
else if (len > 0) {
|
||||||
_writeBody (_body.GetBuffer (), 0, (int) len);
|
_writeBody (_bodyBuffer.GetBuffer (), 0, (int) len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!closing) {
|
if (!closing) {
|
||||||
_body = new MemoryStream ();
|
_bodyBuffer = new MemoryStream ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_sendChunked)
|
if (_sendChunked)
|
||||||
_write (_lastChunk, 0, 5);
|
_write (_lastChunk, 0, 5);
|
||||||
|
|
||||||
_body = null;
|
_bodyBuffer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool flushHeaders (bool closing)
|
private bool flushHeaders (bool closing)
|
||||||
{
|
{
|
||||||
if (!_response.SendChunked) {
|
if (!_response.SendChunked) {
|
||||||
if (_response.ContentLength64 != _body.Length)
|
if (_response.ContentLength64 != _bodyBuffer.Length)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,10 +285,10 @@ namespace WebSocketSharp.Net
|
|||||||
if (_sendChunked)
|
if (_sendChunked)
|
||||||
_write (_lastChunk, 0, 5);
|
_write (_lastChunk, 0, 5);
|
||||||
|
|
||||||
_body.Dispose ();
|
_bodyBuffer.Dispose ();
|
||||||
_response.Abort ();
|
_response.Abort ();
|
||||||
|
|
||||||
_body = null;
|
_bodyBuffer = null;
|
||||||
_response = null;
|
_response = null;
|
||||||
_innerStream = null;
|
_innerStream = null;
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ namespace WebSocketSharp.Net
|
|||||||
throw new ObjectDisposedException (name);
|
throw new ObjectDisposedException (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _body.BeginWrite (buffer, offset, count, callback, state);
|
return _bodyBuffer.BeginWrite (buffer, offset, count, callback, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Close ()
|
public override void Close ()
|
||||||
@ -351,7 +351,7 @@ namespace WebSocketSharp.Net
|
|||||||
throw new ObjectDisposedException (name);
|
throw new ObjectDisposedException (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
_body.EndWrite (asyncResult);
|
_bodyBuffer.EndWrite (asyncResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Flush ()
|
public override void Flush ()
|
||||||
@ -389,7 +389,7 @@ namespace WebSocketSharp.Net
|
|||||||
throw new ObjectDisposedException (name);
|
throw new ObjectDisposedException (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
_body.Write (buffer, offset, count);
|
_bodyBuffer.Write (buffer, offset, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user