func startServer(srv *manners.GracefulServer, globalConfiguration *GlobalConfiguration) { log.Info("Starting server") if len(globalConfiguration.CertFile) > 0 && len(globalConfiguration.KeyFile) > 0 { err := srv.ListenAndServeTLS(globalConfiguration.CertFile, globalConfiguration.KeyFile) if err != nil { log.Fatal("Error creating server: ", err) } } else { err := srv.ListenAndServe() if err != nil { log.Fatal("Error creating server: ", err) } } log.Info("Server stopped") }
func startServer(srv *manners.GracefulServer, globalConfiguration *GlobalConfiguration) { log.Info("Starting server") if len(globalConfiguration.CertFile) > 0 && len(globalConfiguration.KeyFile) > 0 { err := srv.ListenAndServeTLS(globalConfiguration.CertFile, globalConfiguration.KeyFile) if err != nil { netOpError, ok := err.(*net.OpError) if ok && netOpError.Err.Error() != "use of closed network connection" { log.Fatal("Error creating server: ", err) } } } else { err := srv.ListenAndServe() if err != nil { netOpError, ok := err.(*net.OpError) if ok && netOpError.Err.Error() != "use of closed network connection" { log.Fatal("Error creating server: ", err) } } } log.Info("Server stopped") }