code: func (cs *clientStore) isValidWithTimeout(ID string, connID []byte, timeout time.Duration) bool {
  	cs.Lock()
  	c := cs.lookupByConnIDOrID(ID, connID)
  	if c != nil {
  		cs.Unlock()
  		return true
  	}
  	if cs.knownToBeInvalid(ID, connID) {
  		cs.Unlock()
  		return false
  	}
  	if cs.waitOnRegister == nil {
  		cs.waitOnRegister = make(map[string]chan struct{})
  	}
  	ch := make(chan struct{}, 1)
  	cs.waitOnRegister[ID] = ch
  	cs.Unlock()
  	select {
  	case <-ch:
  		return true
  	case <-time.After(timeout):
  		// We timed out, remove the entry in the map
  		cs.Lock()
  		delete(cs.waitOnRegister, ID)
  		cs.addToKnownInvalid(ID, connID)
  		cs.Unlock()
  		return false
  	}
  }
docs: // isValidWithTimeout will return true if the client is registered,
  // false if not.
  // When the client is not yet registered, this call sets up a go channel
  // and waits up to `timeout` for the register() call to send the newly
  // registered client to the channel.
  // On timeout, this call return false to indicate that the client
  // has still not registered.