Skip to content

Commit 62f654e

Browse files
committed
client: make ListSwaps thread safe
1 parent 6066150 commit 62f654e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

loopd/swapclient_server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ func (s *swapClientServer) ListSwaps(_ context.Context,
255255
err error
256256
)
257257

258+
s.swapsLock.Lock()
259+
defer s.swapsLock.Unlock()
260+
258261
// We can just use the server's in-memory cache as that contains the
259262
// most up-to-date state including temporary failures which aren't
260263
// persisted to disk. The swaps field is a map, that's why we need an

0 commit comments

Comments
 (0)