Sleep on error in accept loop.

Avoid flood of error logs upon too many open file error on Linux.
This commit is contained in:
Chen Yufei
2014-07-22 23:44:31 +08:00
parent f4f5ac4f0a
commit 9162aae88a

View File

@@ -169,6 +169,7 @@ func (hp *httpProxy) Serve(wg *sync.WaitGroup) {
if isErrTooManyOpenFd(err) {
connPool.CloseAll()
}
time.Sleep(time.Millisecond)
continue
}
c := newClientConn(conn, hp)
@@ -221,6 +222,7 @@ func (cp *cowProxy) Serve(wg *sync.WaitGroup) {
if isErrTooManyOpenFd(err) {
connPool.CloseAll()
}
time.Sleep(time.Millisecond)
continue
}
ssConn := ss.NewConn(conn, cp.cipher.Copy())