Skip to content

Commit

Permalink
fix: properly handle server shutdown (#164)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 authored Mar 21, 2023
1 parent f753093 commit da4a026
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package wishlist

import (
"context"
"errors"
"fmt"
"net"
"os"
Expand Down Expand Up @@ -82,14 +83,14 @@ func Serve(config *Config) error {
closes = append(closes, closer)
}
if err != nil {
if err2 := closeAll(closes); err2 != nil {
if err2 := closeAll(closes); err2 != nil && !errors.Is(err2, ssh.ErrServerClosed) {
return multierror.Append(err, err2)
}
return err
}
}
<-done
log.Print("Stopping SSH servers")
log.Info("Stopping SSH servers")
return closeAll(closes)
}

Expand Down

0 comments on commit da4a026

Please sign in to comment.