Manually copy relevant fields in ntfn state copy. (#84)

This makes vet happy by manually copying the notification state fields
during the deep copy instead of copying the entire struct which contains
an embedded mutex.
This commit is contained in:
Dave Collins 2016-08-17 12:39:34 -05:00 committed by GitHub
parent f584dbd2e5
commit 2de61b2d9a

View file

@ -47,7 +47,10 @@ func (s *notificationState) Copy() *notificationState {
s.Lock() s.Lock()
defer s.Unlock() defer s.Unlock()
stateCopy := *s var stateCopy notificationState
stateCopy.notifyBlocks = s.notifyBlocks
stateCopy.notifyNewTx = s.notifyNewTx
stateCopy.notifyNewTxVerbose = s.notifyNewTxVerbose
stateCopy.notifyReceived = make(map[string]struct{}) stateCopy.notifyReceived = make(map[string]struct{})
for addr := range s.notifyReceived { for addr := range s.notifyReceived {
stateCopy.notifyReceived[addr] = struct{}{} stateCopy.notifyReceived[addr] = struct{}{}