Refactor connection locking

This commit is contained in:
Patrick Pacher
2020-10-07 11:55:01 +02:00
parent 67f0a98857
commit 75bc5df34d
8 changed files with 216 additions and 105 deletions

View File

@@ -17,14 +17,16 @@ var (
openDNSRequests = make(map[string]*Connection) // key: <pid>/fqdn
openDNSRequestsLock sync.Mutex
// scope prefix
unidentifiedProcessScopePrefix = strconv.Itoa(process.UnidentifiedProcessID) + "/"
)
const (
// write open dns requests every
writeOpenDNSRequestsTickDuration = 5 * time.Second
// duration after which DNS requests without a following connection are logged
openDNSRequestLimit = 3 * time.Second
// scope prefix
unidentifiedProcessScopePrefix = strconv.Itoa(process.UnidentifiedProcessID) + "/"
)
func getDNSRequestCacheKey(pid int, fqdn string) string {