From 2bde0eecf8e521e99479525a04bb41b9371e2efc Mon Sep 17 00:00:00 2001 From: Yilun Date: Mon, 10 Sep 2018 02:19:41 -0700 Subject: [PATCH] Fix bug that will return closed successor Signed-off-by: Yilun --- net/chord/vnode.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/chord/vnode.go b/net/chord/vnode.go index 973ff900e..5ec70765b 100644 --- a/net/chord/vnode.go +++ b/net/chord/vnode.go @@ -335,10 +335,11 @@ func (vn *localVnode) FindSuccessors(n int, key []byte) ([]*Vnode, error) { // Try that node, break on success res, err := vn.ring.transport.FindSuccessors(closest, n, key) - if err != nil { + if err == nil { + return res, nil + } else { nlog.Infof("[WARNING] Failed to contact %s. Got %s", closest.String(), err) } - return res, nil } // Determine how many successors we know of