From 1eb12a1501d837825e87c296c239de842357184f Mon Sep 17 00:00:00 2001 From: Antonin Amand Date: Thu, 19 May 2016 16:45:14 +0200 Subject: [PATCH] fix concurrent map access --- server/route.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/route.go b/server/route.go index 166a0645..50932add 100644 --- a/server/route.go +++ b/server/route.go @@ -423,7 +423,10 @@ func (s *Server) routeSidQueueSubscriber(rsid []byte) (*subscription, bool) { } sid := matches[RSID_SID_INDEX] - if sub, ok := client.subs[string(sid)]; ok { + client.mu.Lock() + sub, ok := client.subs[string(sid)] + client.mu.Unlock() + if ok { return sub, true } return nil, true