public Boolean TryCreateSendBuffer(out WebSocketSendBuffer buffer) { lock ( m_lock ) { if (State >= WebSocketState.Closed) { buffer = default; return(false); } if (IsCompressionEnabled()) { if (m_deflater == null) { m_deflater = new ZLibDeflater(); m_deflater.AddRef(); Closed.ContinueWith(x => m_deflater.Release()); } else { m_deflater.AddRef(); } } } buffer = new WebSocketSendBuffer(m_deflater); return(true); }