mark the peer as dead if the inbound stream closes

fixes #38
This commit is contained in:
Steven Allen 2017-10-14 09:24:44 -07:00
parent 9366bd3c31
commit 3e0c53e2a7
1 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,10 @@ func (p *PubSub) getHelloPacket() *RPC {
}
func (p *PubSub) handleNewStream(s inet.Stream) {
defer func() {
p.peerDead <- s.Conn().RemotePeer()
}()
r := ggio.NewDelimitedReader(s, 1<<20)
for {
rpc := new(RPC)