MCPcopy Index your code
hub / github.com/CodisLabs/codis / init

Function init

cmd/fe/main.go:36–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

IncrMethod · 0.95
DebugfMethod · 0.80
SleepMethod · 0.65

Tested by

no test coverage detected