Browse Source

return back panic in peer#onReceive

Refs #1317
pull/1333/head
Anton Kaliaev 7 years ago
parent
commit
d8b08cd943
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      p2p/peer.go

+ 3
- 1
p2p/peer.go View File

@ -358,7 +358,9 @@ func createMConnection(conn net.Conn, p *peer, reactorsByCh map[byte]Reactor, ch
onReceive := func(chID byte, msgBytes []byte) { onReceive := func(chID byte, msgBytes []byte) {
reactor := reactorsByCh[chID] reactor := reactorsByCh[chID]
if reactor == nil { if reactor == nil {
onPeerError(p, fmt.Errorf("Unknown channel %X", chID))
// Note that its ok to panic here as it's caught in the conn._recover,
// which does onPeerError.
panic(cmn.Fmt("Unknown channel %X", chID))
} }
reactor.Receive(chID, p, msgBytes) reactor.Receive(chID, p, msgBytes)
} }


Loading…
Cancel
Save