From 0be85b356bff61498532bdfefe894880e20d1a25 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Mon, 20 Apr 2020 15:34:52 +0300 Subject: [PATCH] Handling correctly closing the server --- http/http.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/http/http.go b/http/http.go index b6e373a..2fb4f0d 100644 --- a/http/http.go +++ b/http/http.go @@ -23,10 +23,11 @@ func StartServer(server *http.Server, logger slf.Logger) { done := make(chan bool, 1) go func() { logger.Info("Starting the server, HTTP on: :addr", wd.StringParam("addr", server.Addr)) - if err := server.ListenAndServe(); err != nil { + if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed { logger.Emergency("Error in main(): :err", wd.ErrParam(err)) - close(done) } + + close(done) }() go func() {