Compare commits

..

No commits in common. "730bb45db4ea8bbe09a7d71de046da9bbefc5260" and "7a04a22f766b4cd99e06e4275cc321f452337921" have entirely different histories.

2 changed files with 3 additions and 6 deletions

View File

@ -88,17 +88,14 @@ func Stabilize(ctx context.Context, cl Client, n *Node) error {
pred, _, err := cl.Neighbors(ctx, n.Successor())
if err != nil {
// TODO(zeph): replication
return fmt.Errorf("acquiring successor neighbors for stabilization: %w", err)
return 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
}
if err := cl.Notify(ctx, n, n.Successor()); err != nil {
return fmt.Errorf("notifying successor: %w", err)
}
return nil
return cl.Notify(ctx, n, n.Successor())
}
// Notify informs n that p considers n to be p's successor.

View File

@ -80,7 +80,7 @@ func (cl *Client) Notify(ctx context.Context, n *chord.Node, s chord.Peer) error
Scheme: "http",
Host: addr.String(),
Path: path.Join("/", cl.APIBase, "pred"),
RawQuery: url.Values{"p": {self.String()}}.Encode(),
RawQuery: url.Values{"s": {self.String()}}.Encode(),
}
req, err := http.NewRequestWithContext(ctx, "POST", url.String(), nil)
if err != nil {