MCPcopy
hub / github.com/grpc/grpc-go / TimeoutDialer

Method TimeoutDialer

benchmark/latency/latency.go:293–304  ·  view source on GitHub ↗

TimeoutDialer returns a TimeoutDialer that wraps d and injects n's latency in its connections. n's Latency is also injected to the connection's creation.

(d TimeoutDialer)

Source from the content-addressed store, hash-verified

291// in its connections. n's Latency is also injected to the connection's
292// creation.
293func (n *Network) TimeoutDialer(d TimeoutDialer) TimeoutDialer {
294 if n.isLocal() {
295 return d
296 }
297 return func(network, address string, timeout time.Duration) (net.Conn, error) {
298 conn, err := d(network, address, timeout)
299 if err != nil {
300 return nil, err
301 }
302 return n.Conn(conn)
303 }
304}
305
306// ContextDialer returns a ContextDialer that wraps d and injects n's latency
307// in its connections. n's Latency is also injected to the connection's

Callers 1

TestListenerAndDialerMethod · 0.95

Calls 2

isLocalMethod · 0.95
ConnMethod · 0.95

Tested by 1

TestListenerAndDialerMethod · 0.76