[Modify] Polish it
Add a method to release common resources.
This commit is contained in:
parent
1f40f8e566
commit
0b748281e4
@ -791,21 +791,7 @@ namespace WebSocketSharp
|
|||||||
else
|
else
|
||||||
releaseServerResources ();
|
releaseServerResources ();
|
||||||
|
|
||||||
if (_fragmentsBuffer != null) {
|
releaseCommonResources ();
|
||||||
_fragmentsBuffer.Dispose ();
|
|
||||||
_fragmentsBuffer = null;
|
|
||||||
_inContinuation = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_receivePong != null) {
|
|
||||||
_receivePong.Close ();
|
|
||||||
_receivePong = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_exitReceiving != null) {
|
|
||||||
_exitReceiving.Close ();
|
|
||||||
_exitReceiving = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ret = sent && received;
|
var ret = sent && received;
|
||||||
_logger.Debug (
|
_logger.Debug (
|
||||||
@ -1164,6 +1150,25 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void releaseCommonResources ()
|
||||||
|
{
|
||||||
|
if (_fragmentsBuffer != null) {
|
||||||
|
_fragmentsBuffer.Dispose ();
|
||||||
|
_fragmentsBuffer = null;
|
||||||
|
_inContinuation = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_receivePong != null) {
|
||||||
|
_receivePong.Close ();
|
||||||
|
_receivePong = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_exitReceiving != null) {
|
||||||
|
_exitReceiving.Close ();
|
||||||
|
_exitReceiving = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// As server
|
// As server
|
||||||
private void releaseServerResources ()
|
private void releaseServerResources ()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user