Check if Listener exists before trying to close it #26

Merged
dan merged 1 commits from bugfix into master 2020-10-29 22:51:35 +00:00
1 changed files with 3 additions and 1 deletions

View File

@ -172,7 +172,9 @@ func (s *BaseOnionService) Listen(app tapir.Application) error {
func (s *BaseOnionService) Shutdown() {
s.lock.Lock()
defer s.lock.Unlock()
s.ls.Close()
if s.ls != nil {
s.ls.Close()
}
s.connections.Range(func(key, value interface{}) bool {
connection := value.(tapir.Connection)
connection.Close()