// HasNodeConn returns whether the server has a connection to the requested
// Node.
433244
func (s *Status) HasNodeConn(args *structs.NodeSpecificRequest, reply *structs.NodeConnQueryResponse) error {
	// Validate the args
	if args.NodeID == "" {
		return errors.New("Must provide the NodeID")
	}

	state, ok := s.srv.getNodeConn(args.NodeID)
	if ok {
		reply.Connected = true
		reply.Established = state.Established
	}

	return nil
}
1369128
func newConn(nodeID, url string) *conn {
	c := &conn{
		nodeID: nodeID,
		url:    url,
	}
	return c
}
97523
func (s *Simulation) AddNodesAndConnectFull(count int, opts ...AddNodeOption) (ids []enode.ID, err error) {
	if count < 2 {
		return nil, errors.New("count of nodes must be at least 2")
	}
	ids, err = s.AddNodes(count, opts...)
	if err != nil {
		return nil, err
	}
	err = s.Net.ConnectNodesFull(ids)
	if err != nil {
		return nil, err
	}
	return ids, nil
}
1075170
func (ls *LocalStore) Has(ctx context.Context, addr Address) bool {
	return ls.DbStore.Has(ctx, addr)
}
307122
func (net *Network) GetConn(oneID, otherID enode.ID) *Conn {
	net.lock.RLock()
	defer net.lock.RUnlock()
	return net.getConn(oneID, otherID)
}
663133
func (p *Pool) Has(path string) bool {
	p.mu.RLock()
	defer p.mu.RUnlock()

	_, ok := p.connections[path]
	return ok
}
1200809
func (a *addrBook) HasAddress(addr *p2p.NetAddress) bool {
	a.mtx.Lock()
	defer a.mtx.Unlock()

	ka := a.addrLookup[addr.ID]
	return ka != nil
}
981483
func (s *LDBStore) Has(_ context.Context, addr Address) bool {
	s.lock.RLock()
	defer s.lock.RUnlock()

	ikey := getIndexKey(addr)
	_, err := s.db.Get(ikey)

	return err == nil
}
808068
func (s *Session) IsConnected() bool {
	s.mu.RLock()
	defer s.mu.RUnlock()

	if s.cluster == nil || s.closed {
		return false
	}
	return s.cluster.IsConnected()
}
1223690
func isNodeReady(node *v1.Node) bool {
	nodeReadyCondition := findNodeCondition(node, v1.NodeReady)
	if nodeReadyCondition == nil {
		glog.Warningf("v1.NodeReady condition not set on node %s", node.Name)
		return false
	}
	if nodeReadyCondition.Status != v1.ConditionTrue {
		glog.V(4).Infof("node %q not ready: %v", node.Name, nodeReadyCondition)
		return false
	}

	networkUnavailableCondition := findNodeCondition(node, v1.NodeNetworkUnavailable)
	if networkUnavailableCondition != nil {
		if networkUnavailableCondition.Status != v1.ConditionFalse && networkUnavailableCondition.Status != v1.ConditionUnknown {
			glog.V(4).Infof("node %q not ready: %v", node.Name, networkUnavailableCondition)
			return false
		}
	} else {
		glog.V(4).Infof("v1.NodeNetworkUnavailable condition not set on node %s", node.Name)
	}

	return true
}
615947
func (db *DB) conn() (*driverConn, error) {
	db.mu.Lock()
	if db.closed {
		db.mu.Unlock()
		return nil, errDBClosed
	}

	// If db.maxOpen > 0 and the number of open connections is over the limit
	// and there are no free connection, make a request and wait.
	if db.maxOpen > 0 && db.numOpen >= db.maxOpen && len(db.freeConn) == 0 {
		// Make the connRequest channel. It's buffered so that the
		// connectionOpener doesn't block while waiting for the req to be read.
		req := make(chan connRequest, 1)
		db.connRequests = append(db.connRequests, req)
		db.maybeOpenNewConnections()
		db.mu.Unlock()
		ret := <-req
		return ret.conn, ret.err
	}

	if c := len(db.freeConn); c > 0 {
		conn := db.freeConn[0]
		copy(db.freeConn, db.freeConn[1:])
		db.freeConn = db.freeConn[:c-1]
		conn.inUse = true
		db.mu.Unlock()
		return conn, nil
	}

	dsn := db.dsn
	db.numOpen++ // optimistically
	db.mu.Unlock()
	ci, err := db.driver.Open(dsn)
	if err != nil {
		db.mu.Lock()
		db.numOpen-- // correct for earlier optimism
		db.mu.Unlock()
		return nil, err
	}
	db.mu.Lock()
	dc := &driverConn{
		db:  db,
		ci:  ci,
		dsn: dsn,
	}
	db.addDepLocked(dc, dc)
	dc.inUse = true
	db.mu.Unlock()
	return dc, nil
}
1140519
func (t *table) Has(key []byte) (bool, error) {
	return t.db.Has(append([]byte(t.prefix), key...))
}
1327062
func (c *conn) IsDead() bool {
	c.RLock()
	defer c.RUnlock()
	return c.dead
}
537244
func (bc *BlockChain) HasBlock(hash common.Hash, number uint64) bool {
	if bc.blockCache.Contains(hash) {
		return true
	}
	return rawdb.HasBody(bc.db, hash, number)
}
148039
func (s *xlSets) isConnected(endpoint Endpoint) bool {
	s.xlDisksMu.RLock()
	defer s.xlDisksMu.RUnlock()

	for i := 0; i < s.setCount; i++ {
		for j := 0; j < s.drivesPerSet; j++ {
			if s.xlDisks[i][j] == nil {
				continue
			}
			var endpointStr string
			if endpoint.IsLocal {
				endpointStr = endpoint.Path
			} else {
				endpointStr = endpoint.String()
			}
			if s.xlDisks[i][j].String() != endpointStr {
				continue
			}
			return s.xlDisks[i][j].IsOnline()
		}
	}
	return false
}
1101825
func (db *GoLevelDB) Has(key []byte) bool {
	return db.Get(key) != nil
}
1126328
func HasDebug(ctx context.Context) bool {
	_, ok := ctx.Value(ctxKeyDebug).(bool)
	return ok
}