提交 848502de 作者: Juan Batiz-Benet

Merge pull request #1367 from ipfs/wantmanager-cleanup

select with context when sending on channels
...@@ -181,11 +181,17 @@ func (mq *msgQueue) doWork(ctx context.Context) { ...@@ -181,11 +181,17 @@ func (mq *msgQueue) doWork(ctx context.Context) {
} }
func (pm *WantManager) Connected(p peer.ID) { func (pm *WantManager) Connected(p peer.ID) {
pm.connect <- p select {
case pm.connect <- p:
case <-pm.ctx.Done():
}
} }
func (pm *WantManager) Disconnected(p peer.ID) { func (pm *WantManager) Disconnected(p peer.ID) {
pm.disconnect <- p select {
case pm.disconnect <- p:
case <-pm.ctx.Done():
}
} }
// TODO: use goprocess here once i trust it // TODO: use goprocess here once i trust it
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论