// DialTimeout connects to the fcgi responder at the specified network address, using default net.Dialer.
// See func net.Dial for a description of the network and address parameters.
769629
func DialTimeout(network string, address string, timeout time.Duration) (fcgi *FCGIClient, err error) {
	conn, err := net.DialTimeout(network, address, timeout)
	if err != nil {
		return
	}

	fcgi = &FCGIClient{conn: conn, keepAlive: false, reqID: 1}

	return fcgi, nil
}
614789
func (s *ClusterRerouteService) Timeout(timeout string) *ClusterRerouteService {
	s.timeout = timeout
	return s
}
478749
func (d *Dialer) Dial(addr raft.ServerAddress, timeout time.Duration) (net.Conn, error) {
	request := &http.Request{
		Method:     "GET",
		URL:        &url.URL{Path: d.Path},
		Proto:      "HTTP/1.1",
		ProtoMajor: 1,
		ProtoMinor: 1,
		Header:     make(http.Header),
	}
	request.Header.Set("Upgrade", "raft")
	if err := api.AuthHTTPRequest(request, d.APIInfo); err != nil {
		return nil, errors.Trace(err)
	}

	logger.Infof("dialing %s", addr)
	conn, err := d.DialRaw(addr, timeout)
	if err != nil {
		return nil, errors.Annotate(err, "dial failed")
	}

	if err := request.Write(conn); err != nil {
		return nil, errors.Annotate(err, "sending HTTP request failed")
	}

	response, err := http.ReadResponse(bufio.NewReader(conn), request)
	if err != nil {
		return nil, errors.Annotate(err, "failed to read response")
	}
	defer response.Body.Close()
	if response.StatusCode != http.StatusSwitchingProtocols {
		if body, err := ioutil.ReadAll(response.Body); err == nil && len(body) != 0 {
			logger.Tracef("response: %s", body)
		}
		return nil, errors.Errorf(
			"expected status code %d, got %d",
			http.StatusSwitchingProtocols,
			response.StatusCode,
		)
	}
	if response.Header.Get("Upgrade") != "raft" {
		return nil, errors.New("missing or unexpected Upgrade header in response")
	}
	return conn, err
}
74858
func (t *MockTransport) DialTimeout(addr string, timeout time.Duration) (net.Conn, error) {
	dest, ok := t.net.transports[addr]
	if !ok {
		return nil, fmt.Errorf("No route to %q", addr)
	}

	p1, p2 := net.Pipe()
	dest.streamCh <- p1
	return p2, nil
}
161636
func (dc *DispatcherClient) CallTimeout(funcName string, request interface{}, timeout time.Duration) (response interface{}, err error) {
	req := dc.getRequest(funcName, request)
	resp, err := dc.c.CallTimeout(req, timeout)
	return getResponse(resp, err)
}
187434
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
	// Since Linode only updates their zone files every X minutes, we need
	// to figure out how many minutes we have to wait until we hit the next
	// interval of X.  We then wait another couple of minutes, just to be
	// safe.  Hopefully at some point during all of this, the record will
	// have propagated throughout Linode's network.
	minsRemaining := dnsUpdateFreqMins - (time.Now().Minute() % dnsUpdateFreqMins)

	timeout = (time.Duration(minsRemaining) * time.Minute) +
		(minTTL * time.Second) +
		(dnsUpdateFudgeSecs * time.Second)
	interval = d.config.PollingInterval
	return
}
982215
func DialTimeout(network, addr string, timeout time.Duration) (*Client, error) {
	// establish a connection
	conn, err := net.DialTimeout(network, addr, timeout)
	if err != nil {
		return nil, err
	}

	c := new(Client)
	c.Conn = conn
	c.timeout = timeout
	c.reader = bufio.NewReaderSize(conn, bufSize)
	c.writeBuf = make([]byte, 0, 1024)
	return c, nil
}
423374
func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
	c, err := d.Dialer.DialContext(ctx, network, addr)
	if err != nil {
		return nil, err
	}
	conn := NewConn(c)
	conn.readTimeout = d.ReadTimeout
	conn.writeTimeout = d.WriteTimeout
	return conn, nil
}
472782
func DialTimeout(addr string, timeout time.Duration) (*ServerConn, error) {
	return Dial(addr, DialWithTimeout(timeout))
}
1274273
func dialWithDialer(dialer Dialer, timeout time.Duration, network, addr string, config *tls.Config) (*tls.Conn, error) {
	var errChannel chan error
	if timeout != 0 {
		errChannel = make(chan error, 2)
		time.AfterFunc(timeout, func() {
			errChannel <- timeoutError{}
		})
	}

	rawConn, err := dialer.Dial(network, addr)
	if err != nil {
		return nil, err
	}

	conn := tls.Client(rawConn, config)
	if timeout == 0 {
		err = conn.Handshake()
	} else {
		go func() {
			errChannel <- conn.Handshake()
		}()

		err = <-errChannel
	}

	if err != nil {
		rawConn.Close()
		return nil, err
	}

	return conn, nil
}
1255588
func OptDialerTimeout(d time.Duration) Option {
	return func(h *HCI) error {
		h.dialerTmo = d
		return nil
	}
}
610204
func DialTimeoutLocal(socket string, timeout time.Duration) (net.Conn, error) {
	// On windows, we dial a named pipe
	return winio.DialPipe(socket, &timeout)
}
114973
func (n *Network) TimeoutDialer(d TimeoutDialer) TimeoutDialer {
	return func(network, address string, timeout time.Duration) (net.Conn, error) {
		conn, err := d(network, address, timeout)
		if err != nil {
			return nil, err
		}
		return n.Conn(conn)
	}
}
599359
func Dial(network, address string) (fcgi *FCGIClient, err error) {
	return DialContext(context.Background(), network, address)
}
808580
func WithConnectionTimeout(timeout time.Duration) opt {
	return func(t *HttpTunnel) {
		t.parentDialer.Timeout = timeout
	}
}
198931
func (s *ReindexService) Timeout(timeout string) *ReindexService {
	s.timeout = timeout
	return s
}
1275818
func (s *IndicesUnfreezeService) Timeout(timeout string) *IndicesUnfreezeService {
	s.timeout = timeout
	return s
}