chain: call unsub in Incoming* methods
This commit is contained in:
parent
ced47a11e7
commit
4ee2fc4d9f
@ -436,6 +436,8 @@ func (mp *MessagePool) Updates(ctx context.Context) (<-chan api.MpoolUpdate, err
|
|||||||
sub := mp.changes.Sub(localUpdates)
|
sub := mp.changes.Sub(localUpdates)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
defer mp.changes.Unsub(sub, localIncoming)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case u := <-sub:
|
case u := <-sub:
|
||||||
|
@ -153,6 +153,8 @@ func (syncer *Syncer) IncomingBlocks(ctx context.Context) (<-chan *types.BlockHe
|
|||||||
out := make(chan *types.BlockHeader, 10)
|
out := make(chan *types.BlockHeader, 10)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
defer syncer.incoming.Unsub(sub, localIncoming)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case r := <-sub:
|
case r := <-sub:
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"gopkg.in/urfave/cli.v2"
|
"gopkg.in/urfave/cli.v2"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var dotCmd = &cli.Command{
|
var dotCmd = &cli.Command{
|
||||||
|
Loading…
Reference in New Issue
Block a user