in pkg/profiling/task/network/analyze/layer4/listener.go [238:272]
func (l *Listener) combineExceptionToConnections(ccs map[string]*base.ConnectionContext, exps map[SocketBasicKey]*SocketExceptionValue) {
for key, value := range exps {
var remotePort, localPort = uint16(key.RemotePort), uint16(key.LocalPort)
var remoteIP, localIP string
if key.Family == unix.AF_INET {
remoteIP = parseAddressV4(key.RemoteAddrV4)
localIP = parseAddressV4(key.LocalAddrV4)
} else if key.Family == unix.AF_INET6 {
remoteIP = parseAddressV6(key.RemoteAddrV6)
localIP = parseAddressV6(key.LocalAddrV6)
} else {
continue
}
var firstRemoteMatch *base.ConnectionContext
var foundAllAddrMatch bool
for _, cc := range ccs {
// only add to the first matches
if cc.RemoteIP == remoteIP && cc.RemotePort == remotePort {
firstRemoteMatch = cc
if cc.LocalIP == localIP && cc.LocalPort == localPort {
l.mergeExceptionToAppointConnection(value, cc)
foundAllAddrMatch = true
break
}
}
}
// if only remote address match, then just add to the first one
if !foundAllAddrMatch && firstRemoteMatch != nil {
l.mergeExceptionToAppointConnection(value, firstRemoteMatch)
}
}
}