fix goroutine leak

This commit is contained in:
klizhentas 2016-04-26 17:20:51 -07:00
parent 09671910a3
commit e7387f6ed1

View file

@ -224,6 +224,10 @@ func (a *Agent) proxyTransport(ch ssh.Channel, reqC <-chan *ssh.Request) {
go func() {
defer wg.Done()
// make sure that we close the client connection on a channel
// close, otherwise the other goroutine would never know
// as it will block on read from the connection
defer conn.Close()
io.Copy(conn, ch)
}()