diff options
author | Quentin <quentin@deuxfleurs.fr> | 2021-11-20 15:10:21 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2021-11-20 15:10:21 +0100 |
commit | a171e8418967f005b6943d769636eefe95f1a2ea (patch) | |
tree | 460bf82416f3146221d1e2d85aeeae6de05bc230 /main.go | |
parent | e10f04c5e36109c2e58d667c4b6ec054cbdd51be (diff) | |
download | bagage-a171e8418967f005b6943d769636eefe95f1a2ea.tar.gz bagage-a171e8418967f005b6943d769636eefe95f1a2ea.zip |
Better error management
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -97,6 +97,7 @@ func handleSSHConn(nConn net.Conn, dconfig *Config, config *ssh.ServerConfig) { serverConn, chans, reqs, err := ssh.NewServerConn(nConn, config) if err != nil { log.Printf("failed to handshake: ", err) + return } defer serverConn.Conn.Close() user := serverConn.Conn.User() @@ -120,6 +121,7 @@ func handleSSHConn(nConn net.Conn, dconfig *Config, config *ssh.ServerConfig) { channel, requests, err := newChannel.Accept() if err != nil { log.Print("could not accept channel.", err) + return } log.Printf("Channel accepted\n") @@ -155,7 +157,8 @@ func handleSSHConn(nConn net.Conn, dconfig *Config, config *ssh.ServerConfig) { server, err := sftp.NewServer(ctx, channel, &fs) if err != nil { - log.Fatal(err) + log.Println(err) + return } if err := server.Serve(); err == io.EOF { |