deliverFin method

void deliverFin(
  1. int finalSize
)

Records where the stream ends. finalSize is the offset one past the peer's last byte.

A FIN is a flag on a frame that can overtake data still in flight, so closing the stream on its arrival would silently truncate whatever had not caught up. The stream finishes when the delivered bytes reach finalSize, which may be now or may be several packets away.

Implementation

void deliverFin(int finalSize) {
  _finalSize = finalSize;
  _checkFinished();
}