Commit bedbf112 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f70489a3
......@@ -1336,7 +1336,19 @@ func (m *Master) __accept(peer *_MasteredPeer, idReq *neonet.Request) error {
// TODO indicate that initial phase of accept is done
peer.wg.Go(peer.notify) // main -> peer δnodeTab/δpartTab/δcluterState to proxy to peer link
m.mainWG.Go(peer.waitAll) // main <- peer "peer (should be) disconnected"
// go main <- peer "peer (should be) disconnected"
m.mainWG.Go(func (_ context.Context) error {
// wait for all tasks related to peer to complete and then
// notify main that peer node should go. Don't take ctx into
// account - it is ~ runCtx and should be parent of context
// under which per-peer tasks are spawned. This way if runCtx
// is canceled -> any per-peer ctx should be canceled too and
// wg.Wait should not block.
err := peer.wg.Wait()
m.nodeLeaveq <- nodeLeave{peer, err} // XXX detect if if main is already done
return nil // XXX or ctx.Err() ?
})
return nil
}
......@@ -1403,6 +1415,7 @@ func (p *_MasteredPeer) notify(ctx context.Context) (err error) {
return nil
}
/*
// waitAll waits for all tasks related to peer to complete and then notifies
// main that peer node should go. It is spawned under mainWG.
// XXX naming -> wait?
......@@ -1417,6 +1430,7 @@ func (p *_MasteredPeer) waitAll(_ context.Context) error {
m.nodeLeaveq <- nodeLeave{p, err} // XXX detect if if main is already done
return nil // XXX or ctx.Err() ?
}
*/
// XXX run runs f after initial phase of peer acceptance is over.
//
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment