Commit 62f2f357 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bedbf112
......@@ -108,6 +108,7 @@ type nodeCome struct {
// nodeLeave represents "node (should be) disconnected" event.
type nodeLeave struct {
peer *_MasteredPeer
err error // XXX needed ?
}
// _MasteredPeer represents context for all tasks related to one peer driven by master.
......@@ -1415,22 +1416,6 @@ 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?
// XXX inline into identify
func (p *_MasteredPeer) waitAll(_ context.Context) error {
// don't take our 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 := p.wg.Wait()
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.
//
......@@ -1440,9 +1425,9 @@ func (p *_MasteredPeer) waitAll(_ context.Context) error {
// nodeTab to see if peer laddr is not overlapping with anyone's, and to assign
// nid). Because main is involved we cannot move it to completely separate task
// and give main only one Accept entry point to call.
func (p *_MasteredPeer) run(f) error {
func (p *_MasteredPeer) run(ctx context.Context, f func() error) error {
// XXX wait p.acceptDone
// XXX f()
return f()
}
// allocNID allocates new node ID for a node of kind nodeType.
......
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