MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Add

Method Add

internal/conns/map.go:25–43  ·  view source on GitHub ↗
(conn net.Conn)

Source from the content-addressed store, hash-verified

23}
24
25func (this *Map) Add(conn net.Conn) {
26 if conn == nil {
27 return
28 }
29
30 key, ip, ok := this.connAddr(conn)
31 if !ok {
32 return
33 }
34
35 this.locker.Lock()
36 defer this.locker.Unlock()
37 connMap, ok := this.m[ip]
38 if !ok {
39 this.m[ip] = map[string]net.Conn{key: conn}
40 } else {
41 connMap[key] = conn
42 }
43}
44
45func (this *Map) Remove(conn net.Conn) {
46 if conn == nil {

Callers

nothing calls this directly

Calls 3

connAddrMethod · 0.95
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected