提交 b12cc09f 作者: Jeromy

select with context when sending on channels

License: MIT
Signed-off-by: 's avatarJeromy <jeromyj@gmail.com>
上级 952dc9c6
......@@ -168,11 +168,17 @@ func (mq *msgQueue) runQueue(ctx context.Context) {
}
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) {
pm.disconnect <- p
select {
case pm.disconnect <- p:
case <-pm.ctx.Done():
}
}
// TODO: use goprocess here once i trust it
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论