closeWrite method
Sends FIN and waits (bounded) for the remote's FIN_ACK, so data sent before it is known to have arrived.
Implementation
@override
Future<void> closeWrite() async {
if (_localWriteClosed || _reset != null) return;
await _writeChain; // FIN goes after queued data
_localWriteClosed = true;
_sendFlag(FrameFlag.fin);
try {
await _finAck.future.timeout(finAckTimeout);
} on TimeoutException {
_log.fine('stream $_id: no FIN_ACK within ${finAckTimeout.inSeconds} s');
} on ResetException {
// reset while closing; nothing left to wait for
}
_closeChannelIfDone();
}