From 236dc57a9e6860f322588a9007aeb2936efef4e4 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 10 Nov 2016 22:40:16 -0800 Subject: [PATCH] fix unsafe acces on arm Signed-off-by: Victor Vieux --- libnetwork/networkdb/networkdb.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libnetwork/networkdb/networkdb.go b/libnetwork/networkdb/networkdb.go index 2518030e30..087398e3cf 100644 --- a/libnetwork/networkdb/networkdb.go +++ b/libnetwork/networkdb/networkdb.go @@ -24,6 +24,15 @@ const ( // NetworkDB instance drives the networkdb cluster and acts the broker // for cluster-scoped and network-scoped gossip and watches. type NetworkDB struct { + // The clocks MUST be the first things + // in this struct due to Golang issue #599. + + // Global lamport clock for node network attach events. + networkClock serf.LamportClock + + // Global lamport clock for table events. + tableClock serf.LamportClock + sync.RWMutex // NetworkDB configuration. @@ -59,12 +68,6 @@ type NetworkDB struct { // waiting for an ack. bulkSyncAckTbl map[string]chan struct{} - // Global lamport clock for node network attach events. - networkClock serf.LamportClock - - // Global lamport clock for table events. - tableClock serf.LamportClock - // Broadcast queue for network event gossip. networkBroadcasts *memberlist.TransmitLimitedQueue