// Only call at the end of the Mainloop or HeartbeatLoop public void FinishClose() { // Notify hearbeat loops that they can leave m_heartbeatRead.Set(); m_heartbeatWrite.Set(); m_closed = true; MaybeStopHeartbeatTimers(); m_frameHandler.Close(); m_model0.SetCloseReason(m_closeReason); m_model0.FinishClose(); }