MCPcopy
hub / github.com/grafana/dskit / DialTimeout

Method DialTimeout

kv/memberlist/tcp_transport.go:599–616  ·  view source on GitHub ↗

DialTimeout is used to create a connection that allows memberlist to perform two-way communication with a peer.

(addr string, timeout time.Duration)

Source from the content-addressed store, hash-verified

597// DialTimeout is used to create a connection that allows memberlist to perform
598// two-way communication with a peer.
599func (t *TCPTransport) DialTimeout(addr string, timeout time.Duration) (net.Conn, error) {
600 t.outgoingStreams.Inc()
601 c, err := t.getConnection(addr, timeout)
602
603 if err != nil {
604 t.outgoingStreamErrors.Inc()
605 return nil, err
606 }
607
608 _, err = c.Write([]byte{byte(stream)})
609 if err != nil {
610 t.outgoingStreamErrors.Inc()
611 _ = c.Close()
612 return nil, err
613 }
614
615 return c, nil
616}
617
618// StreamCh returns a channel that can be read to handle incoming stream
619// connections from other peers.

Callers 2

getConnectionMethod · 0.80

Calls 3

getConnectionMethod · 0.95
CloseMethod · 0.65
WriteMethod · 0.45