connection pool: ssh can't work when pool_count is set, fix #193

This commit is contained in:
fatedier
2016-12-26 01:55:54 +08:00
parent 4c3fb22295
commit 9faf4acd62
3 changed files with 69 additions and 19 deletions

View File

@@ -205,16 +205,18 @@ func (sc *sharedConn) Read(p []byte) (n int, err error) {
sc.Unlock()
return sc.Conn.Read(p)
}
sc.Unlock()
n, err = sc.buff.Read(p)
if err == io.EOF {
sc.Lock()
sc.buff = nil
sc.Unlock()
var n2 int
n2, err = sc.Conn.Read(p[n:])
n += n2
}
sc.Unlock()
return
}