@@ -144,9 +144,7 @@ func (s *Server) upgradeConnection(conn net.Conn) {
144
144
log .Printf ("New SSH connection from %s (%s)" , conn .RemoteAddr (), sshConn .ClientVersion ())
145
145
146
146
defer func () {
147
- if err := conn .Close (); err != nil {
148
- s .handleError (err , nil )
149
- }
147
+ conn .Close ()
150
148
log .Printf ("Closed connection to %s" , conn .RemoteAddr ())
151
149
}()
152
150
go ssh .DiscardRequests (reqs )
@@ -261,10 +259,7 @@ func (s *Server) handleRequests(reqs <-chan *ssh.Request, channel ssh.Channel, c
261
259
}
262
260
break Loop
263
261
}
264
- case err := <- done :
265
- if err != nil {
266
- s .handleError (err , nil )
267
- }
262
+ case <- done :
268
263
break Loop
269
264
}
270
265
}
@@ -308,12 +303,6 @@ func (s *Server) handleRequests(reqs <-chan *ssh.Request, channel ssh.Channel, c
308
303
}
309
304
310
305
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
-
317
306
if s .shellCreds != nil {
318
307
cmd .SysProcAttr = & syscall.SysProcAttr {Credential : s .shellCreds }
319
308
}
@@ -324,8 +313,8 @@ func (s *Server) launchCommand(channel ssh.Channel, cmd *exec.Cmd, terminal *pty
324
313
return err
325
314
}
326
315
327
- go ioCopy (terminal , channel )
328
- go ioCopy (channel , terminal )
316
+ go io . Copy (terminal , channel )
317
+ go io . Copy (channel , terminal )
329
318
} else {
330
319
stdout , err := cmd .StdoutPipe ()
331
320
if err != nil {
@@ -346,9 +335,9 @@ func (s *Server) launchCommand(channel ssh.Channel, cmd *exec.Cmd, terminal *pty
346
335
return err
347
336
}
348
337
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 )
352
341
}
353
342
354
343
return nil
0 commit comments