Commit 48faf697 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 149be5e9
......@@ -368,8 +368,18 @@ func (c *Client) recvMaster(ctx context.Context) (err error) {
for {
req, err := c.node.RecvM1()
if err != nil {
return err // XXX eventReconnect
switch {
// reconnected to master
case errors.Is(err, eventMasterReconnect):
c.head0 = c.head
// XXX -> initFromMaster
default:
return err
}
continue
}
err = c.recvMaster1(req.Msg)
req.Close()
if err != nil {
......
......@@ -219,7 +219,16 @@ func (node *_MasteredNode) talkMaster1(ctx context.Context) error {
}
// XXX update .masterLink + notify waiters
// XXX rxm <- eventReconnect
// RecvM1 <- eventReconnect
select {
case <-ctx.Done():
return ctx.Err()
case node.rxm <- _RxM{Err: eventMasterReconnect}:
// ok
}
// receive and handle notifications from master
defer task.Running(&ctx, "rx")(&err)
......@@ -275,6 +284,8 @@ func (node *_MasteredNode) recvMaster1(ctx context.Context, req neonet.Request)
return nil
}
var eventMasterReconnect = errors.New("(re)connected to master")
// RecvM1 receives request from master filtered through δstate handler.
//
// XXX eventReconnect
......
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