Browse Source

fix race

pull/456/head
Anton Kaliaev 8 years ago
parent
commit
5ab8ca0868
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      addrbook.go

+ 6
- 4
addrbook.go View File

@ -135,15 +135,15 @@ func (a *AddrBook) OnStart() error {
return nil
}
func (a *AddrBook) Wait() {
a.wg.Wait()
}
// OnStop implements Service.
func (a *AddrBook) OnStop() {
a.BaseService.OnStop()
}
func (a *AddrBook) Wait() {
a.wg.Wait()
}
func (a *AddrBook) AddOurAddress(addr *NetAddress) {
a.mtx.Lock()
defer a.mtx.Unlock()
@ -320,6 +320,8 @@ type addrBookJSON struct {
func (a *AddrBook) saveToFile(filePath string) {
log.Info("Saving AddrBook to file", "size", a.Size())
a.mtx.Lock()
defer a.mtx.Unlock()
// Compile Addrs
addrs := []*knownAddress{}
for _, ka := range a.addrLookup {


Loading…
Cancel
Save