Fix: listener tcp keepalive & reuse net.BufferedConn (#1987)

This commit is contained in:
Kaming Chan
2022-02-23 11:22:46 +08:00
committed by GitHub
parent 03e4b5d525
commit 132a6a6a2f
3 changed files with 9 additions and 7 deletions

View File

@ -64,6 +64,8 @@ func New(addr string, in chan<- C.ConnContext) (*Listener, error) {
}
func handleConn(conn net.Conn, in chan<- C.ConnContext, cache *cache.Cache) {
conn.(*net.TCPConn).SetKeepAlive(true)
bufConn := N.NewBufferedConn(conn)
head, err := bufConn.Peek(1)
if err != nil {