Only abort on EINVAL from tcp Accept()

This commit is contained in:
Michael Crosby 2014-12-12 23:08:18 -08:00
parent 973a06aa75
commit ba1dd64475

View File

@ -7,6 +7,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"sync" "sync"
"syscall"
"time" "time"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
@ -226,10 +227,12 @@ func (s *Server) Start(laddr string) error {
conn, err := socket.Accept() conn, err := socket.Accept()
if err != nil { if err != nil {
logger.Errorf("Failed to accept connection: %v", err)
if err == syscall.EINVAL {
// TODO: Handle shutdown more gracefully? // TODO: Handle shutdown more gracefully?
logger.Errorf("Failed to accept connection, aborting loop: %v", err)
return return
} }
}
// Goroutineify to resume accepting sockets early. // Goroutineify to resume accepting sockets early.
go func() { go func() {