Commit 1059b27f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 00845e93
......@@ -1219,7 +1219,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
// spawn task to send accept and proxy δnodeTab/δpartTab to the peer
peer.wg.Go(func(ctx context.Context) error {
// go main <- peer "peer (should be) disconnected" when all peer's task finish
m.mainWG.Go(func(_ context.Context) error {
m.mainWG.Go(func(ctx 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
......@@ -1227,8 +1227,13 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (peer *_MasteredPeer,
// 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() ?
select {
case <-ctx.Done():
return ctx.Err()
case m.nodeLeaveq <- nodeLeave{peer, err}:
return nil // ok
}
})
// XXX err -> indicated that accept0 failed ?
......
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