// pollHost queries the DC/OS hsot for metrics and returns.
183928
func (c *Collector) pollHost() {
	now := time.Now().UTC()
	c.timestamp = now.Unix()

	// Fetch node-level metrics for all DC/OS roles
	c.log.Debugf("Fetching node-level metrics from DC/OS host %s", c.nodeInfo.Hostname)
	nm, err := getNodeMetrics()
	if err != nil {
		c.log.Errorf("Failed to get node-level metrics. %s", err)
	} else {
		c.nodeMetrics = nm
	}

	c.log.Infof("Finished polling DC/OS host %s, took %f seconds.", c.nodeInfo.Hostname, time.Since(now).Seconds())
}
769213
func SSHHost(e alicloudSSHHelper, private bool) func(multistep.StateBag) (string, error) {
	return func(state multistep.StateBag) (string, error) {
		ipAddress := state.Get("ipaddress").(string)
		return ipAddress, nil
	}
}
449668
func (st *State) getOpsForHostPortsChange(
	mc mongo.Collection,
	key string,
	newHostPorts [][]network.HostPort,
) ([]txn.Op, error) {
	var ops []txn.Op

	// Retrieve the current document. Return an insert operation if not found.
	var extantHostPortDoc apiHostPortsDoc
	err := mc.Find(bson.D{{"_id", key}}).One(&extantHostPortDoc)
	if err != nil {
		if err == mgo.ErrNotFound {
			return []txn.Op{{
				C:      controllersC,
				Id:     key,
				Insert: bson.D{{"apihostports", fromNetworkHostsPorts(newHostPorts)}},
			}}, nil
		}
		return ops, err
	}

	// Queue an update operation if the host/port collections differ.
	extantHostPorts := networkHostsPorts(extantHostPortDoc.APIHostPorts)
	if !hostsPortsEqual(newHostPorts, extantHostPorts) {
		ops = []txn.Op{{
			C:  controllersC,
			Id: key,
			Assert: bson.D{{
				"txn-revno", extantHostPortDoc.TxnRevno,
			}},
			Update: bson.D{{
				"$set", bson.D{{"apihostports", fromNetworkHostsPorts(newHostPorts)}},
			}},
		}}
		logger.Debugf("setting %s: %v", key, newHostPorts)
	}
	return ops, nil
}
260270
func (s *SamplingRule) SetHost(v string) *SamplingRule {
	s.Host = &v
	return s
}
327492
func (t *Termbox) PollEvent(ctx context.Context) chan termbox.Event {
	// XXX termbox.PollEvent() can get stuck on unexpected signal
	// handling cases. We still would like to wait until the user
	// (termbox) has some event for us to process, but we don't
	// want to allow termbox to control/block our input loop.
	//
	// Solution: put termbox polling in a separate goroutine,
	// and we just watch for a channel. The loop can now
	// safely be implemented in terms of select {} which is
	// safe from being stuck.
	evCh := make(chan termbox.Event)

	go func() {
		// keep listening to suspend requests here
		for {
			select {
			case <-ctx.Done():
				return
			case <-t.suspendCh:
				if pdebug.Enabled {
					pdebug.Printf("poll event suspended!")
				}
				t.Close()
			}
		}
	}()

	go func() {
		defer func() { recover() }()
		defer func() { close(evCh) }()

		for {
			ev := termbox.PollEvent()
			if ev.Type != termbox.EventInterrupt {
				evCh <- ev
				continue
			}

			select {
			case <-ctx.Done():
				return
			case replyCh := <-t.resumeCh:
				t.Init()
				close(replyCh)
			}
		}
	}()
	return evCh

}
69484
func PollTime(pt time.Duration) Option {
	return func(s *Scroller) error {
		if pt == 0 {
			pt = defaultPollTime
		}
		s.pollTime = pt
		return nil
	}
}
485472
func (tp *TransferPoller) Poll() error {
	tp.syncTimer.Pause()
	err := tp.pollTransfers()
	tp.syncTimer.Resume()
	return err
}
462337
func StopHost(api libmachine.API) error {
	host, err := api.Load(cfg.GetMachineName())
	if err != nil {
		return errors.Wrapf(err, "load")
	}
	console.OutStyle("stopping", "Stopping %q in %s ...", cfg.GetMachineName(), host.DriverName)
	if err := host.Stop(); err != nil {
		alreadyInStateError, ok := err.(mcnerror.ErrHostAlreadyInState)
		if ok && alreadyInStateError.State == state.Stopped {
			return nil
		}
		return &util.RetriableError{Err: errors.Wrapf(err, "Stop: %s", cfg.GetMachineName())}
	}
	return nil
}
1048126
func Localhost() (net.IP, error) {
	ips, err := net.LookupIP("localhost")
	if err != nil {
		return nil, err
	}
	if len(ips) < 1 {
		return nil, errors.New("IP lookup for localhost returned no result")
	}
	return ips[0], nil
}
279752
func (s *Server) GetHost(hostID string, reply *host.Host) error {
	response, err := s.f.GetHost(s.context(), hostID)
	if err != nil {
		return err
	}
	if response == nil {
		return facade.ErrHostDoesNotExist
	}
	*reply = *response
	return nil
}
220819
func (p *LongPoller) Poll(b *Bot, dest chan Update, stop chan struct{}) {
	go func(stop chan struct{}) {
		<-stop
		close(stop)
	}(stop)

	for {
		updates, err := b.getUpdates(p.LastUpdateID+1, p.Timeout)

		if err != nil {
			b.debug(ErrCouldNotUpdate)
			continue
		}

		for _, update := range updates {
			p.LastUpdateID = update.ID
			dest <- update
		}
	}
}
1079802
func GetHost(r *http.Request) string {
	h := r.URL.Host
	if h == "" {
		h = r.Host
	}
	return h
}
995255
func (c *Client) DeleteHost(p *DeleteHostParameter) (*Result, error) {
	obj, err := c.Request("deleteHost", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
524252
func CommHost(state multistep.StateBag) (string, error) {
	vmName := state.Get("vmName").(string)
	driver := state.Get("driver").(Driver)

	mac, err := driver.MAC(vmName)
	if err != nil {
		return "", err
	}

	ip, err := driver.IPAddress(mac)
	if err != nil {
		return "", err
	}

	return ip, nil
}
1243872
func (self *HerokuDeploy) RedirectHost() string {
	if self.IsTest() {
		return fmt.Sprintf(REDIRECT_HOST_TEST, self.Port())
	}
	return fmt.Sprintf(HEROKU_HOST, self.herokuName)
}
998021
func (m *Manager) ValidateHost(ctx context.Context, ovfDescriptor string, host mo.Reference, vhp types.OvfValidateHostParams) (*types.OvfValidateHostResult, error) {
	req := types.ValidateHost{
		This:          m.Reference(),
		OvfDescriptor: ovfDescriptor,
		Host:          host.Reference(),
		Vhp:           vhp,
	}

	res, err := methods.ValidateHost(ctx, m.c, &req)
	if err != nil {
		return nil, err
	}

	return &res.Returnval, nil
}
872400
func (cl *Client) Poll(timeout time.Duration) {
	if timeout < 0 {
		C.rd_kafka_poll(cl.handle, -1)
	} else {
		timeoutMs := C.int(timeout.Nanoseconds() / 1000000)
		C.rd_kafka_poll(cl.handle, timeoutMs)
	}
}