Skip to content

Commit bc28fce

Browse files
im-kulikovvishr
authored andcommitted
Fix unhandled errors (#1271)
1 parent 6d9e043 commit bc28fce

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

echo.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -764,13 +764,14 @@ type tcpKeepAliveListener struct {
764764
}
765765

766766
func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
767-
tc, err := ln.AcceptTCP()
768-
if err != nil {
767+
if c, err = ln.AcceptTCP(); err != nil {
768+
return
769+
} else if err = c.(*net.TCPConn).SetKeepAlive(true); err != nil {
770+
return
771+
} else if err = c.(*net.TCPConn).SetKeepAlivePeriod(3 * time.Minute); err != nil {
769772
return
770773
}
771-
tc.SetKeepAlive(true)
772-
tc.SetKeepAlivePeriod(3 * time.Minute)
773-
return tc, nil
774+
return
774775
}
775776

776777
func newListener(address string) (*tcpKeepAliveListener, error) {

0 commit comments

Comments
 (0)