MCPcopy Create free account
hub / github.com/DNAProject/DNA / GetIpCountInInConnRecord

Method GetIpCountInInConnRecord

p2pserver/net/netserver/netserver.go:565–577  ·  view source on GitHub ↗

GetIpCountInInConnRecord return count of in connections with single ip

(ip string)

Source from the content-addressed store, hash-verified

563
564//GetIpCountInInConnRecord return count of in connections with single ip
565func (this *NetServer) GetIpCountInInConnRecord(ip string) uint {
566 this.inConnRecord.RLock()
567 defer this.inConnRecord.RUnlock()
568 var count uint
569 var ipRecord string
570 for addr := range this.inConnRecord.InConnectingAddrs {
571 ipRecord, _ = common.ParseIPAddr(addr)
572 if 0 == strings.Compare(ipRecord, ip) {
573 count++
574 }
575 }
576 return count
577}
578
579//AddOutConnRecord add out connection to outConnRecord
580func (this *NetServer) AddOutConnRecord(addr string) {

Callers 2

startNetAcceptMethod · 0.95
TestInConnAPIFunction · 0.80

Calls 1

ParseIPAddrFunction · 0.92

Tested by 1

TestInConnAPIFunction · 0.64