From 67b1e3c5f2e326aa0a6eae437bed8365a23eb410 Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Sat, 3 Oct 2015 20:23:26 -0700 Subject: [PATCH] Fix in bitseq.NewHandle() - When creating the handle, write it to store if not present. Currently it is written to store only on first bit allocation. Signed-off-by: Alessandro Boch --- libnetwork/bitseq/sequence.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libnetwork/bitseq/sequence.go b/libnetwork/bitseq/sequence.go index 006fee29a4..1120ac77c8 100644 --- a/libnetwork/bitseq/sequence.go +++ b/libnetwork/bitseq/sequence.go @@ -65,6 +65,13 @@ func NewHandle(app string, ds datastore.DataStore, id string, numElements uint32 return nil, err } + // If the handle is not in store, write it. + if !h.Exists() { + if err := h.writeToStore(); err != nil { + return nil, fmt.Errorf("failed to write bitsequence to store: %v", err) + } + } + return h, nil }