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

Method getConnection

kv/memberlist/tcp_transport.go:372–384  ·  view source on GitHub ↗
(addr string, timeout time.Duration)

Source from the content-addressed store, hash-verified

370}
371
372func (t *TCPTransport) getConnection(addr string, timeout time.Duration) (net.Conn, error) {
373 var conn net.Conn
374 var err error
375 if t.cfg.TLSEnabled {
376 conn, err = tls.DialWithDialer(&net.Dialer{Timeout: timeout}, "tcp", addr, t.tlsConfig)
377 } else {
378 conn, err = net.DialTimeout("tcp", addr, timeout)
379 }
380 if err != nil {
381 return nil, err
382 }
383 return newMeteredConn(conn, t.sentBytes, t.receivedBytes), nil
384}
385
386// GetAutoBindPort returns the bind port that was automatically given by the
387// kernel, if a bind port of 0 was given.

Callers 2

writeToMethod · 0.95
DialTimeoutMethod · 0.95

Calls 2

newMeteredConnFunction · 0.85
DialTimeoutMethod · 0.80

Tested by

no test coverage detected