From ba1dd64475664406c41427797db19a37f35b06d7 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 12 Dec 2014 23:08:18 -0800 Subject: [PATCH] Only abort on EINVAL from tcp Accept() --- server.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server.go b/server.go index 11bd2ff..fc6711d 100644 --- a/server.go +++ b/server.go @@ -7,6 +7,7 @@ import ( "regexp" "strings" "sync" + "syscall" "time" "golang.org/x/crypto/ssh" @@ -226,9 +227,11 @@ func (s *Server) Start(laddr string) error { conn, err := socket.Accept() if err != nil { - // TODO: Handle shutdown more gracefully? - logger.Errorf("Failed to accept connection, aborting loop: %v", err) - return + logger.Errorf("Failed to accept connection: %v", err) + if err == syscall.EINVAL { + // TODO: Handle shutdown more gracefully? + return + } } // Goroutineify to resume accepting sockets early.