Skip to content

Commit

Permalink
fix: graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Aug 23, 2022
1 parent 880a761 commit 216ccee
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,18 @@ func (srv *Server) Reload() error {

// Start starts the SSH server.
func (srv *Server) Start() error {
return srv.SSHServer.ListenAndServe()
if err := srv.SSHServer.ListenAndServe(); err != ssh.ErrServerClosed {
return err
}
return nil
}

// Serve serves the SSH server using the provided listener.
func (srv *Server) Serve(l net.Listener) error {
return srv.SSHServer.Serve(l)
if err := srv.SSHServer.Serve(l); err != ssh.ErrServerClosed {
return err
}
return nil
}

// Shutdown lets the server gracefully shutdown.
Expand Down

0 comments on commit 216ccee

Please sign in to comment.