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

Method lookupIPAddr

pkg/topom/context.go:112–126  ·  view source on GitHub ↗
(addr string)

Source from the content-addressed store, hash-verified

110}
111
112func (ctx *context) lookupIPAddr(addr string) net.IP {
113 ctx.hosts.Lock()
114 defer ctx.hosts.Unlock()
115 ip, ok := ctx.hosts.m[addr]
116 if !ok {
117 if tcpAddr := utils.ResolveTCPAddrTimeout(addr, 50*time.Millisecond); tcpAddr != nil {
118 ctx.hosts.m[addr] = tcpAddr.IP
119 return tcpAddr.IP
120 } else {
121 ctx.hosts.m[addr] = nil
122 return nil
123 }
124 }
125 return ip
126}
127
128func (ctx *context) toReplicaGroups(gid int, p *models.Proxy) [][]string {
129 g := ctx.group[gid]

Callers 1

toReplicaGroupsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected