diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index 491a4596b..b647660b3 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -260,9 +260,9 @@ func (s *Server) Start() { }() } -// Shutdown stops the RPC server. It can only be called once. +// Shutdown stops the RPC server if it's running. func (s *Server) Shutdown() { - if !s.started.Load() { + if !s.started.CAS(true, false) { return } // Signal to websocket writer routines and handleSubEvents.