Browse Source

pex: do not send nil envelopes to the reactor (#7622)

pull/7623/head
M. J. Fromberger 3 years ago
committed by GitHub
parent
commit
417166704a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      internal/p2p/pex/reactor.go

+ 5
- 1
internal/p2p/pex/reactor.go View File

@ -171,10 +171,14 @@ func (r *Reactor) processPexCh(ctx context.Context) {
defer close(incoming) defer close(incoming)
iter := r.pexCh.Receive(ctx) iter := r.pexCh.Receive(ctx)
for iter.Next(ctx) { for iter.Next(ctx) {
env := iter.Envelope()
if env == nil {
break
}
select { select {
case <-ctx.Done(): case <-ctx.Done():
return return
case incoming <- iter.Envelope():
case incoming <- env:
} }
} }
}() }()


Loading…
Cancel
Save