rpc/server: make double Shutdown a no-op

This commit is contained in:
Roman Khimov 2022-07-01 22:01:04 +03:00
parent 527505ea5e
commit c096f32a32

View file

@ -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() { func (s *Server) Shutdown() {
if !s.started.Load() { if !s.started.CAS(true, false) {
return return
} }
// Signal to websocket writer routines and handleSubEvents. // Signal to websocket writer routines and handleSubEvents.