Skip to content

Commit 7e5ddb9

Browse files
committed
Remove excessively verbose logging
Change-Type: patch
1 parent d60d43c commit 7e5ddb9

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

Diff for: .errcheck.exclude

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
io.Copy
2+
(net.Conn).Close

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lint: lint-dep
2222
gofmt -e -l -s .
2323
golint -set_exit_status ./...
2424
go tool vet .
25-
errcheck -verbose ./...
25+
errcheck -exclude .errcheck.exclude -verbose ./...
2626

2727
test-dep: dep
2828
go test -i -v ./...

Diff for: sshproxy.go

+7-18
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ func (s *Server) upgradeConnection(conn net.Conn) {
144144
log.Printf("New SSH connection from %s (%s)", conn.RemoteAddr(), sshConn.ClientVersion())
145145

146146
defer func() {
147-
if err := conn.Close(); err != nil {
148-
s.handleError(err, nil)
149-
}
147+
conn.Close()
150148
log.Printf("Closed connection to %s", conn.RemoteAddr())
151149
}()
152150
go ssh.DiscardRequests(reqs)
@@ -261,10 +259,7 @@ func (s *Server) handleRequests(reqs <-chan *ssh.Request, channel ssh.Channel, c
261259
}
262260
break Loop
263261
}
264-
case err := <-done:
265-
if err != nil {
266-
s.handleError(err, nil)
267-
}
262+
case <-done:
268263
break Loop
269264
}
270265
}
@@ -308,12 +303,6 @@ func (s *Server) handleRequests(reqs <-chan *ssh.Request, channel ssh.Channel, c
308303
}
309304

310305
func (s *Server) launchCommand(channel ssh.Channel, cmd *exec.Cmd, terminal *pty.Terminal) error {
311-
ioCopy := func(dst io.Writer, src io.Reader) {
312-
if _, err := io.Copy(dst, src); err != nil {
313-
s.handleError(err, nil)
314-
}
315-
}
316-
317306
if s.shellCreds != nil {
318307
cmd.SysProcAttr = &syscall.SysProcAttr{Credential: s.shellCreds}
319308
}
@@ -324,8 +313,8 @@ func (s *Server) launchCommand(channel ssh.Channel, cmd *exec.Cmd, terminal *pty
324313
return err
325314
}
326315

327-
go ioCopy(terminal, channel)
328-
go ioCopy(channel, terminal)
316+
go io.Copy(terminal, channel)
317+
go io.Copy(channel, terminal)
329318
} else {
330319
stdout, err := cmd.StdoutPipe()
331320
if err != nil {
@@ -346,9 +335,9 @@ func (s *Server) launchCommand(channel ssh.Channel, cmd *exec.Cmd, terminal *pty
346335
return err
347336
}
348337

349-
go ioCopy(stdin, channel)
350-
go ioCopy(channel, stdout)
351-
go ioCopy(channel.Stderr(), stderr)
338+
go io.Copy(stdin, channel)
339+
go io.Copy(channel, stdout)
340+
go io.Copy(channel.Stderr(), stderr)
352341
}
353342

354343
return nil

0 commit comments

Comments
 (0)