public void StopReadFromSocket() { PipeWriter.CancelPendingFlush(); // unblock Readable (may race with CompleteReadable) Action continuation = Interlocked.Exchange(ref _readableCompletion, _stopSentinel); continuation?.Invoke(); }