Closed JackyWYX closed 3 years ago
When running pub-sub with option WithBlacklist, the program panics and exits with the following error:
WithBlacklist
goroutine 166 [running]: github.com/libp2p/go-libp2p-pubsub.(*PubSub).processLoop.func1(0xc000381080) /home/yx/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.4.0/pubsub.go:472 +0x85 panic(0x18322a0, 0x1ee0070) /usr/local/go/src/runtime/panic.go:965 +0x1b9 github.com/libp2p/go-libp2p-pubsub.(*PubSub).processLoop(0xc000381080, 0x1f27790, 0xc001708780) /home/yx/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.4.0/pubsub.go:524 +0xd58 created by github.com/libp2p/go-libp2p-pubsub.NewPubSub /home/yx/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.4.0/pubsub.go:293 +0xb7e
The peer channel is closed but it is not removed from PubSub.peers (Code reference) which will leave a closed peer channel at peers field.
PubSub.peers
peers
Description
When running pub-sub with option
WithBlacklist
, the program panics and exits with the following error:Potential problem
The peer channel is closed but it is not removed from
PubSub.peers
(Code reference) which will leave a closed peer channel atpeers
field.