diff --git a/chord/client.go b/chord/client.go index 4280b9e..e5d9a60 100644 --- a/chord/client.go +++ b/chord/client.go @@ -88,14 +88,17 @@ func Stabilize(ctx context.Context, cl Client, n *Node) error { pred, _, err := cl.Neighbors(ctx, n.Successor()) if err != nil { // TODO(zeph): replication - return err + return fmt.Errorf("acquiring successor neighbors for stabilization: %w", err) } if pred.IsValid() && contains(n.self.id, n.Successor().id, pred.id) && pred.id != n.Successor().id { // Shift in the new successor. copy(n.succ[1:], n.succ) n.succ[0] = pred } - return cl.Notify(ctx, n, n.Successor()) + if err := cl.Notify(ctx, n, n.Successor()); err != nil { + return fmt.Errorf("notifying successor: %w", err) + } + return nil } // Notify informs n that p considers n to be p's successor.