Skip to content
Snippets Groups Projects
Commit b12cc09f authored by Jeromy Johnson's avatar Jeromy Johnson
Browse files

select with context when sending on channels


License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 952dc9c6
No related branches found
No related tags found
1 merge request!1New
...@@ -168,11 +168,17 @@ func (mq *msgQueue) runQueue(ctx context.Context) { ...@@ -168,11 +168,17 @@ func (mq *msgQueue) runQueue(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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment