From 62f654eef1cd48b2732fd9eb8aac0eab827ebefa Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Thu, 30 Apr 2020 15:48:58 +0200 Subject: [PATCH] client: make ListSwaps thread safe --- loopd/swapclient_server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index f3528d9..0616cc8 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -255,6 +255,9 @@ func (s *swapClientServer) ListSwaps(_ context.Context, err error ) + s.swapsLock.Lock() + defer s.swapsLock.Unlock() + // We can just use the server's in-memory cache as that contains the // most up-to-date state including temporary failures which aren't // persisted to disk. The swaps field is a map, that's why we need an