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

Method ContextDialer

benchmark/latency/latency.go:309–320  ·  view source on GitHub ↗

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

(d ContextDialer)

Source from the content-addressed store, hash-verified

307// in its connections. n's Latency is also injected to the connection's
308// creation.
309func (n *Network) ContextDialer(d ContextDialer) ContextDialer {
310 if n.isLocal() {
311 return d
312 }
313 return func(ctx context.Context, network, address string) (net.Conn, error) {
314 conn, err := d(ctx, network, address)
315 if err != nil {
316 return nil, err
317 }
318 return n.Conn(conn)
319 }
320}
321
322// pktTime returns the time it takes to transmit one packet of data of size b
323// in bytes.

Callers 1

makeClientsFunction · 0.95

Calls 2

isLocalMethod · 0.95
ConnMethod · 0.95

Tested by

no test coverage detected