mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
RWMutex may help performance in DNS tracking
This commit is contained in:
parent
b95c63f0c0
commit
a8a52f8650
1 changed files with 3 additions and 3 deletions
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
responses = make(map[string]string, 0)
|
responses = make(map[string]string, 0)
|
||||||
lock = sync.Mutex{}
|
lock = sync.RWMutex{}
|
||||||
)
|
)
|
||||||
|
|
||||||
func TrackAnswers(packet gopacket.Packet) bool {
|
func TrackAnswers(packet gopacket.Packet) bool {
|
||||||
|
@ -63,8 +63,8 @@ func Track(resolved string, hostname string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Host(resolved string) (host string, found bool) {
|
func Host(resolved string) (host string, found bool) {
|
||||||
lock.Lock()
|
lock.RLock()
|
||||||
defer lock.Unlock()
|
defer lock.RUnlock()
|
||||||
|
|
||||||
host, found = responses[resolved]
|
host, found = responses[resolved]
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue