[ARVADOS] updated: 1.1.0-26-g237adbd
Git user
git at public.curoverse.com
Mon Oct 16 10:42:22 EDT 2017
Summary of changes:
sdk/go/keepclient/block_cache.go | 6 +++---
sdk/go/keepclient/keepclient_test.go | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
via 237adbd91e2dc0d15f79390f7e38f70d55372877 (commit)
from 02adf6134d262d17066dbc48d3fb85c8861c8349 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 237adbd91e2dc0d15f79390f7e38f70d55372877
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Oct 16 10:41:18 2017 -0400
12447: Fix typo shadowing 'data' in BlockCache.Get
Move locking to BlockCache.setup()
Tweak tests to bind explicitly to loopback address.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/sdk/go/keepclient/block_cache.go b/sdk/go/keepclient/block_cache.go
index 1849fa2..5d8daad 100644
--- a/sdk/go/keepclient/block_cache.go
+++ b/sdk/go/keepclient/block_cache.go
@@ -67,7 +67,7 @@ func (c *BlockCache) Get(kc *KeepClient, locator string) ([]byte, error) {
rdr, size, _, err := kc.Get(locator)
var data []byte
if err == nil {
- data := make([]byte, size, BLOCKSIZE)
+ data = make([]byte, size, BLOCKSIZE)
_, err = io.ReadFull(rdr, data)
err2 := rdr.Close()
if err == nil {
@@ -94,13 +94,13 @@ func (c *BlockCache) Get(kc *KeepClient, locator string) ([]byte, error) {
}
func (c *BlockCache) setup() {
+ c.mtx.Lock()
c.cache = make(map[string]*cacheBlock)
+ c.mtx.Unlock()
}
func (c *BlockCache) Clear() {
- c.mtx.Lock()
c.setup()
- c.mtx.Unlock()
}
type timeSlice []time.Time
diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go
index e12db26..3ce4e74 100644
--- a/sdk/go/keepclient/keepclient_test.go
+++ b/sdk/go/keepclient/keepclient_test.go
@@ -111,7 +111,9 @@ func (sph StubPutHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request)
func RunFakeKeepServer(st http.Handler) (ks KeepServer) {
var err error
- ks.listener, err = net.ListenTCP("tcp", &net.TCPAddr{Port: 0})
+ // If we don't explicitly bind it to localhost, ks.listener.Addr() will
+ // bind to 0.0.0.0 or [::] which is not a valid address for Dial()
+ ks.listener, err = net.ListenTCP("tcp", &net.TCPAddr{IP: []byte{127, 0, 0, 1}, Port: 0})
if err != nil {
panic(fmt.Sprintf("Could not listen on any port"))
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list