|
|
@@ -45,7 +45,7 @@ type Firehol struct {
|
|
45
|
45
|
ctxCancel context.CancelFunc
|
|
46
|
46
|
logger mtglib.Logger
|
|
47
|
47
|
|
|
48
|
|
- rwMutex sync.RWMutex
|
|
|
48
|
+ updateMutex sync.RWMutex
|
|
49
|
49
|
|
|
50
|
50
|
remoteURLs []string
|
|
51
|
51
|
localFiles []string
|
|
|
@@ -68,8 +68,8 @@ func (f *Firehol) Contains(ip net.IP) bool {
|
|
68
|
68
|
return true
|
|
69
|
69
|
}
|
|
70
|
70
|
|
|
71
|
|
- f.rwMutex.RLock()
|
|
72
|
|
- defer f.rwMutex.RUnlock()
|
|
|
71
|
+ f.updateMutex.RLock()
|
|
|
72
|
+ defer f.updateMutex.RUnlock()
|
|
73
|
73
|
|
|
74
|
74
|
if ip4 := ip.To4(); ip4 != nil {
|
|
75
|
75
|
return f.containsIPv4(ip4)
|
|
|
@@ -194,8 +194,8 @@ func (f *Firehol) update() error { // nolint: funlen, cyclop
|
|
194
|
194
|
default:
|
|
195
|
195
|
}
|
|
196
|
196
|
|
|
197
|
|
- f.rwMutex.Lock()
|
|
198
|
|
- defer f.rwMutex.Unlock()
|
|
|
197
|
+ f.updateMutex.Lock()
|
|
|
198
|
+ defer f.updateMutex.Unlock()
|
|
199
|
199
|
|
|
200
|
200
|
f.treeV4 = v4tree
|
|
201
|
201
|
f.treeV6 = v6tree
|