private void CloseInternal(StatusCode reason, int lastSeenStreamId, bool sendGoAway)
{
if (this.opened)
{
this.opened = false;
if (sendGoAway)
SendGoAway(lastSeenStreamId, reason);
if (this.OnClose != null)
{
this.OnClose(this, new CloseFrameEventArgs(new CloseFrameExt() { LastGoodSessionId = lastSeenStreamId, StatusCode = (int)reason }));
}
this.socket.Close();
this.serializer.Dispose();
}
}