proxy.go: Don't close listener when met 'accept: too many open files' error
Since this error is temporary, we should continue to serving.
This commit is contained in:
parent
3dd888a9ea
commit
afffbb5aa9
@ -156,7 +156,11 @@ func (pxy *BaseProxy) startListenHandler(p Proxy, handler func(Proxy, net.Conn,
|
|||||||
// if listener is closed, err returned
|
// if listener is closed, err returned
|
||||||
c, err := l.Accept()
|
c, err := l.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
xl.Info("listener is closed")
|
xl.Warn("listener is closed: %s", err)
|
||||||
|
if err2, ok := err.(*net.OpError); ok && err2.Temporary() {
|
||||||
|
xl.Info("met temporary error when accepting, continue ...")
|
||||||
|
continue
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
xl.Info("get a user connection [%s]", c.RemoteAddr().String())
|
xl.Info("get a user connection [%s]", c.RemoteAddr().String())
|
||||||
|
Loading…
Reference in New Issue
Block a user