Skip to content

Commit

Permalink
fix sftp client hang on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
ferama committed Nov 26, 2023
1 parent 8c617b1 commit bf76fe4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/sshd/channel_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ func (s *channelHandler) handleSftpRequest(channel ssh.Channel) {
if err != nil {
log.Fatal(err)
}
if err := server.Serve(); err == io.EOF {
server.Close()
log.Print("sftp client exited session.")
} else if err != nil {
log.Printf("sftp server completed with error: %s", err)
if err := server.Serve(); err != nil {
if err != io.EOF {
log.Fatal("sftp server completed with error:", err)
}
}
server.Close()
log.Print("sftp client exited session.")
}

func (s *channelHandler) sendSignal(channel ssh.Channel, signal string) {
Expand Down

0 comments on commit bf76fe4

Please sign in to comment.