Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

cmd/swamr-smoke: fix waitToPushSynced connection closing #1781

Merged
merged 2 commits into from
Sep 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions cmd/swarm-smoke/upload_and_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,24 +333,25 @@ func waitToPushSynced(tagname string) {
for {
time.Sleep(200 * time.Millisecond)

rpcClient, err := rpc.Dial(wsEndpoint(hosts[0]))
if rpcClient != nil {
defer rpcClient.Close()
}
if err != nil {
log.Error("error dialing host", "err", err)
continue
}

bzzClient := client.NewBzz(rpcClient)
if func() (synced bool) {
rpcClient, err := rpc.Dial(wsEndpoint(hosts[0]))
if rpcClient != nil {
defer rpcClient.Close()
}
if err != nil {
log.Error("error dialing host", "err", err)
return false
}

synced, err := bzzClient.IsPushSynced(tagname)
if err != nil {
log.Error(err.Error())
continue
}
bzzClient := client.NewBzz(rpcClient)

if synced {
synced, err = bzzClient.IsPushSynced(tagname)
if err != nil {
log.Error(err.Error())
return false
}
return synced
}() {
return
}
}
Expand Down