From 311ed516cef678797df01311a638d1afcadf6d63 Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 23 Mar 2020 07:59:38 +0000 Subject: [PATCH] log.Fatal on failure to listen to SSH port (#10795) Fix #10792 --- modules/ssh/ssh_graceful.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/ssh/ssh_graceful.go b/modules/ssh/ssh_graceful.go index f8370ab4db2e..a30e6fc29741 100644 --- a/modules/ssh/ssh_graceful.go +++ b/modules/ssh/ssh_graceful.go @@ -16,7 +16,12 @@ func listen(server *ssh.Server) { err := gracefulServer.ListenAndServe(server.Serve) if err != nil { - log.Critical("Failed to start SSH server: %v", err) + select { + case <-graceful.GetManager().IsShutdown(): + log.Critical("Failed to start SSH server: %v", err) + default: + log.Fatal("Failed to start SSH server: %v", err) + } } log.Info("SSH Listener: %s Closed", server.Addr)