Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions transport/graphsync/graphsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,9 +894,13 @@ func (c *dtChannel) open(ctx context.Context, chid datatransfer.ChannelID, dataS
// Set up a completed channel that will be closed when the request
// completes (or is cancelled)
completed := make(chan struct{})
var onCompleteOnce sync.Once
onComplete := func() {
log.Infow("closing the completion ch for data-transfer channel", "chid", chid)
close(completed)
// Ensure the channel is only closed once
onCompleteOnce.Do(func() {
log.Infow("closing the completion ch for data-transfer channel", "chid", chid)
close(completed)
})
}
c.completed = completed

Expand Down