[#1291] innerring: Don't stop the same listener twice

When IR node configured without main chain, both
`morphListener` and `mainnetListener` are pointing
into single listener component. We should not call
`Stop()` twice, because it may trigger channel
closing in neo-go or other components and it
can throw panic.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
remotes/fyrchik/morph-listener-ptr
Alex Vanin 2022-03-15 14:32:25 +03:00 committed by Alex Vanin
parent d311585de6
commit 77f4a5844b
1 changed files with 3 additions and 1 deletions

View File

@ -282,7 +282,9 @@ func (s *Server) Stop() {
s.setHealthStatus(control.HealthStatus_SHUTTING_DOWN)
go s.morphListener.Stop()
go s.mainnetListener.Stop()
if !s.withoutMainNet {
go s.mainnetListener.Stop()
}
for _, c := range s.closers {
if err := c(); err != nil {