code: func (l *listenContext) createConnectedEndpoint(s *segment, iss seqnum.Value, irs seqnum.Value, rcvdSynOpts *header.TCPSynOptions) (*endpoint, *tcpip.Error) {
  	// Create a new endpoint.
  	netProto := l.netProto
  	if netProto == 0 {
  		netProto = s.route.NetProto
  	}
  	n := newEndpoint(l.stack, netProto, nil)
  	n.v6only = l.v6only
  	n.id = s.id
  	n.boundNICID = s.route.NICID()
  	n.route = s.route.Clone()
  	n.effectiveNetProtos = []tcpip.NetworkProtocolNumber{s.route.NetProto}
  	n.rcvBufSize = int(l.rcvWnd)
  
  	n.maybeEnableTimestamp(rcvdSynOpts)
  	n.maybeEnableSACKPermitted(rcvdSynOpts)
  
  	n.initGSO()
  
  	// Register new endpoint so that packets are routed to it.
  	if err := n.stack.RegisterTransportEndpoint(n.boundNICID, n.effectiveNetProtos, ProtocolNumber, n.id, n, n.reusePort); err != nil {
  		n.Close()
  		return nil, err
  	}
  
  	n.isRegistered = true
  	n.state = stateConnected
  
  	// Create sender and receiver.
  	//
  	// The receiver at least temporarily has a zero receive window scale,
  	// but the caller may change it (before starting the protocol loop).
  	n.snd = newSender(n, iss, irs, s.window, rcvdSynOpts.MSS, rcvdSynOpts.WS)
  	n.rcv = newReceiver(n, irs, l.rcvWnd, 0)
  
  	return n, nil
  }
docs: // createConnectedEndpoint creates a new connected endpoint, with the connection
  // parameters given by the arguments.