code: func (cm *ConnManager) Connect(c *ConnReq) {
  	if atomic.LoadInt32(&cm.stop) != 0 {
  		return
  	}
  
  	// During the time we wait for retry there is a chance that
  	// this connection was already cancelled
  	if c.State() == ConnCanceled {
  		log.Debugf("Ignoring connect for canceled connreq=%v", c)
  		return
  	}
  
  	if atomic.LoadUint64(&c.id) == 0 {
  		atomic.StoreUint64(&c.id, atomic.AddUint64(&cm.connReqCount, 1))
  
  		// Submit a request of a pending connection attempt to the
  		// connection manager. By registering the id before the
  		// connection is even established, we'll be able to later
  		// cancel the connection via the Remove method.
  		done := make(chan struct{})
  		select {
  		case cm.requests <- registerPending{c, done}:
  		case <-cm.quit:
  			return
  		}
  
  		// Wait for the registration to successfully add the pending
  		// conn req to the conn manager's internal state.
  		select {
  		case <-done:
  		case <-cm.quit:
  			return
  		}
  	}
  
  	log.Debugf("Attempting to connect to %v", c)
  
  	conn, err := cm.cfg.Dial(c.Addr)
  	if err != nil {
  		select {
  		case cm.requests <- handleFailed{c, err}:
  		case <-cm.quit:
  		}
  		return
  	}
  
  	select {
  	case cm.requests <- handleConnected{c, conn}:
  	case <-cm.quit:
  	}
  }
docs: // Connect assigns an id and dials a connection to the address of the
  // connection request.