mirror of
https://github.com/safing/portmaster
synced 2025-09-09 13:54:52 +00:00
Streamline configuration
This commit is contained in:
parent
77d7a63bc3
commit
279ab67c7e
12 changed files with 354 additions and 191 deletions
|
@ -158,13 +158,14 @@ func deduplicateRequest(ctx context.Context, q *Query) (finishRequest func()) {
|
|||
dupKey := fmt.Sprintf("%s%s", q.FQDN, q.QType.String())
|
||||
|
||||
dupReqLock.Lock()
|
||||
defer dupReqLock.Unlock()
|
||||
|
||||
// get duplicate request waitgroup
|
||||
wg, requestActive := dupReqMap[dupKey]
|
||||
|
||||
// someone else is already on it!
|
||||
if requestActive {
|
||||
dupReqLock.Unlock()
|
||||
|
||||
// log that we are waiting
|
||||
log.Tracer(ctx).Tracef("intel: waiting for duplicate query for %s to complete", dupKey)
|
||||
// wait
|
||||
|
@ -182,6 +183,8 @@ func deduplicateRequest(ctx context.Context, q *Query) (finishRequest func()) {
|
|||
// add to registry
|
||||
dupReqMap[dupKey] = wg
|
||||
|
||||
dupReqLock.Unlock()
|
||||
|
||||
// return function to mark request as finished
|
||||
return func() {
|
||||
dupReqLock.Lock()
|
||||
|
@ -222,7 +225,7 @@ resolveLoop:
|
|||
rrCache, err = resolver.Conn.Query(ctx, q)
|
||||
if err != nil {
|
||||
|
||||
// FIXME: check if we are online?
|
||||
// TODO: check if we are online?
|
||||
|
||||
switch {
|
||||
case errors.Is(err, ErrNotFound):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue