MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / withTCPDialer

Function withTCPDialer

rpc/mux/pool_test.go:49–66  ·  view source on GitHub ↗

withTCPDialer overwrites the node-oriented dialer of rpc package, skips the naconn resolver and implies a default resolving method: addr := string(remote node ID).

()

Source from the content-addressed store, hash-verified

47// withTCPDialer overwrites the node-oriented dialer of rpc package, skips the naconn resolver
48// and implies a default resolving method: addr := string(remote node ID).
49func withTCPDialer() func() {
50 dial := rpc.Dial
51 dialEx := rpc.DialEx
52
53 rpc.Dial = func(remote proto.NodeID) (net.Conn, error) {
54 return net.Dial("tcp", string(remote))
55 }
56
57 rpc.DialEx = func(remote proto.NodeID, isAnonymous bool) (net.Conn, error) {
58 return net.Dial("tcp", string(remote))
59 }
60
61 // recover func
62 return func() {
63 rpc.Dial = dial
64 rpc.DialEx = dialEx
65 }
66}
67
68func BenchmarkSessionPool_Get(b *testing.B) {
69 Convey("session pool", b, func(c C) {

Callers 2

BenchmarkSessionPool_GetFunction · 0.85
TestNewSessionPoolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected