fix: BlockStream rpc: only cancel response context at the end

This commit is contained in:
Hector Sanjuan 2022-03-28 17:55:31 +02:00
parent 8908da32be
commit f07c1e6552

View File

@ -572,7 +572,7 @@ func (rpcapi *IPFSConnectorRPCAPI) SwarmPeers(ctx context.Context, in struct{},
// BlockStream runs IPFSConnector.BlockStream(). // BlockStream runs IPFSConnector.BlockStream().
func (rpcapi *IPFSConnectorRPCAPI) BlockStream(ctx context.Context, in <-chan api.NodeWithMeta, out chan<- struct{}) error { func (rpcapi *IPFSConnectorRPCAPI) BlockStream(ctx context.Context, in <-chan api.NodeWithMeta, out chan<- struct{}) error {
close(out) defer close(out) // very important to do at the end
return rpcapi.ipfs.BlockStream(ctx, in) return rpcapi.ipfs.BlockStream(ctx, in)
} }