Skip to content

Commit

Permalink
Do not try to create intermitent nodes if they exist during Lock()
Browse files Browse the repository at this point in the history
This causes problems if Authentication is enabled.
  • Loading branch information
Pawel Rozlach committed Jun 29, 2016
1 parent 218e9c8 commit 607ad79
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion zk/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,16 @@ func (l *Lock) Lock() error {
parts := strings.Split(l.path, "/")
pth := ""
for _, p := range parts[1:] {
var exists bool
pth += "/" + p
_, err := l.c.Create(pth, []byte{}, 0, l.acl)
exists, _, err = l.c.Exists(pth)
if err != nil {
return err
}
if exists == true {
continue
}
_, err = l.c.Create(pth, []byte{}, 0, l.acl)
if err != nil && err != ErrNodeExists {
return err
}
Expand Down

0 comments on commit 607ad79

Please sign in to comment.