Merge pull request #1484 from denniswon/fix_memory_leak

close peer sync config connections to prevent duplicate peer sync config creation
pull/1488/head pangaea-20190903.0
Dennis JongHyuck Won 5 years ago committed by GitHub
commit c9f0bb3483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      api/service/syncing/syncing.go

@ -217,6 +217,9 @@ func (ss *StateSync) CreateSyncConfig(peers []p2p.Peer, isBeacon bool) error {
if len(peers) == 0 { if len(peers) == 0 {
return ctxerror.New("[SYNC] no peers to connect to") return ctxerror.New("[SYNC] no peers to connect to")
} }
if ss.syncConfig != nil {
ss.syncConfig.CloseConnections()
}
ss.syncConfig = &SyncConfig{} ss.syncConfig = &SyncConfig{}
var wg sync.WaitGroup var wg sync.WaitGroup
for _, peer := range peers { for _, peer := range peers {

Loading…
Cancel
Save