MCPcopy
hub / github.com/CodisLabs/codis / init

Function init

pkg/utils/rpc/api.go:32–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30var client *http.Client
31
32func init() {
33 var dials atomic2.Int64
34 tr := &http.Transport{}
35 tr.Dial = func(network, addr string) (net.Conn, error) {
36 c, err := net.DialTimeout(network, addr, time.Second)
37 if err == nil {
38 log.Debugf("rpc: dial new connection to [%d] %s - %s",
39 dials.Incr()-1, network, addr)
40 }
41 return c, err
42 }
43 client = &http.Client{
44 Transport: tr,
45 Timeout: time.Minute,
46 }
47 go func() {
48 for {
49 time.Sleep(time.Minute)
50 tr.CloseIdleConnections()
51 }
52 }()
53}
54
55type RemoteError struct {
56 Cause string

Callers

nothing calls this directly

Calls 3

IncrMethod · 0.95
DebugfMethod · 0.80
SleepMethod · 0.65

Tested by

no test coverage detected