code: func (t *TCB) adaptResult(r Result) Result {
  	// Check the unmodified case.
  	if r != ResultAlive || !t.inbound.closed() || !t.outbound.closed() {
  		return r
  	}
  
  	// Find out which was closed first.
  	if t.firstFin == &t.outbound {
  		return ResultClosedBySelf
  	}
  
  	return ResultClosedByPeer
  }
docs: // adapResult modifies the supplied "Result" according to the state of the TCB;
  // if r is anything other than "Alive", or if one of the streams isn't closed
  // yet, it is returned unmodified. Otherwise it's converted to either
  // ClosedBySelf or ClosedByPeer depending on which stream was closed first.