Skip to content

Commit

Permalink
dht_net: more consistent handling of retry resets; check for streamRe…
Browse files Browse the repository at this point in the history
…useTries after increment
  • Loading branch information
vyzo committed Sep 17, 2017
1 parent 9959ee5 commit c4f4864
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dht_net.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ func (ms *messageSender) SendMessage(ctx context.Context, pmes *pb.Message) erro

log.Event(ctx, "dhtSentMessage", ms.dht.self, ms.p, pmes)

if ms.singleMes > streamReuseTries {
ms.resetHard()
} else if retry {
if retry {
ms.singleMes++
if ms.singleMes > streamReuseTries {
ms.resetHard()
}
}

return nil
Expand Down Expand Up @@ -303,10 +304,9 @@ func (ms *messageSender) SendRequest(ctx context.Context, pmes *pb.Message) (*pb

if retry {
ms.lk.Lock()
ms.singleMes++
if ms.singleMes > streamReuseTries {
ms.resetSoft(rcount)
} else {
ms.singleMes++
}
ms.lk.Unlock()
}
Expand Down

0 comments on commit c4f4864

Please sign in to comment.