Commit b5b0419e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 45f14a0c
...@@ -99,7 +99,6 @@ type Master struct { ...@@ -99,7 +99,6 @@ type Master struct {
} }
// nodeCome represents "node connects" event. // nodeCome represents "node connects" event.
// XXX main <- accept
type nodeCome struct { type nodeCome struct {
req *neonet.Request req *neonet.Request
idReq *proto.RequestIdentification // we received this identification request idReq *proto.RequestIdentification // we received this identification request
...@@ -302,7 +301,7 @@ func (m *Master) Run(ctx context.Context, l xnet.Listener) (err error) { ...@@ -302,7 +301,7 @@ func (m *Master) Run(ctx context.Context, l xnet.Listener) (err error) {
err = ctx.Err() err = ctx.Err()
} }
xio.LClose(ctx, lli) // XXX here ok? (probbly not) xio.LClose(ctx, lli) // XXX here ok? (probably not)
return err return err
} }
...@@ -1007,34 +1006,22 @@ func (m *Master) serveClient(ctx context.Context, cli *_MasteredPeer) (err error ...@@ -1007,34 +1006,22 @@ func (m *Master) serveClient(ctx context.Context, cli *_MasteredPeer) (err error
defer task.Runningf(&ctx, "%s: serve client", cli.node.NID)(&err) defer task.Runningf(&ctx, "%s: serve client", cli.node.NID)(&err)
clink := cli.node.Link() clink := cli.node.Link()
// wg, ctx := errgroup.WithContext(ctx) // XXX -> sync.WorkGroup
defer xio.CloseWhenDone(ctx, clink)() // XXX -> cli.ResetLink? (better not here) defer xio.CloseWhenDone(ctx, clink)() // XXX -> cli.ResetLink? (better not here)
/* XXX kill
// M -> C notifications about cluster state
wg.Go(func() error {
return m.keepPeerUpdated(ctx, clink)
})
*/
// M <- C requests handler // M <- C requests handler
// wg.Go(func() error { for {
for { req, err := clink.Recv1()
req, err := clink.Recv1() if err != nil {
if err != nil { return err
return err }
}
resp := m.serveClient1(ctx, req.Msg) resp := m.serveClient1(ctx, req.Msg)
err = req.Reply(resp) err = req.Reply(resp)
req.Close() req.Close()
if err != nil { if err != nil {
return err return err
}
} }
// }) }
//
// return wg.Wait()
} }
// serveClient1 prepares response for 1 request from client. // serveClient1 prepares response for 1 request from client.
......
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