mirror of
https://github.com/fiatjaf/nak.git
synced 2026-10-05 15:18:23 +00:00
Merge pull request #158 from mattn/fix/sync-deltas-close-on-error
sync: close the Deltas channel on error returns too
This commit is contained in:
@@ -204,6 +204,9 @@ func NewThirdPartyNegentropy(peerA, peerB *RelayThirdPartyRemote, filter nostr.F
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ThirdPartyNegentropy) Run(ctx context.Context) error {
|
func (n *ThirdPartyNegentropy) Run(ctx context.Context) error {
|
||||||
|
// always close Deltas so the consumer goroutine doesn't hang when we return an error
|
||||||
|
defer close(n.Deltas)
|
||||||
|
|
||||||
peerAIds := make(map[nostr.ID]struct{})
|
peerAIds := make(map[nostr.ID]struct{})
|
||||||
peerBIds := make(map[nostr.ID]struct{})
|
peerBIds := make(map[nostr.ID]struct{})
|
||||||
peerASkippedBounds := make(map[boundKey]struct{})
|
peerASkippedBounds := make(map[boundKey]struct{})
|
||||||
@@ -341,7 +344,6 @@ func (n *ThirdPartyNegentropy) Run(ctx context.Context) error {
|
|||||||
|
|
||||||
n.PeerA.SendClose()
|
n.PeerA.SendClose()
|
||||||
n.PeerB.SendClose()
|
n.PeerB.SendClose()
|
||||||
close(n.Deltas)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user