mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-31 21:27:04 +00:00
fix race
This commit is contained in:
+6
-4
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user