code: func (ep *endpoint) Close() {
  	ep.mu.Lock()
  	defer ep.mu.Unlock()
  
  	if ep.closed {
  		return
  	}
  
  	ep.stack.UnregisterRawTransportEndpoint(ep.registeredNIC, ep.netProto, ep.transProto, ep)
  
  	ep.rcvMu.Lock()
  	defer ep.rcvMu.Unlock()
  
  	// Clear the receive list.
  	ep.rcvClosed = true
  	ep.rcvBufSize = 0
  	for !ep.rcvList.Empty() {
  		ep.rcvList.Remove(ep.rcvList.Front())
  	}
  
  	if ep.connected {
  		ep.route.Release()
  	}
  
  	ep.waiterQueue.Notify(waiter.EventHUp | waiter.EventErr | waiter.EventIn | waiter.EventOut)
  }
docs: // Close implements tcpip.Endpoint.Close.