File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -64,17 +64,21 @@ func (cn *Conn) RemoteAddr() net.Addr {
6464}
6565
6666func (cn * Conn ) WithReader (ctx context.Context , timeout time.Duration , fn func (rd * proto.Reader ) error ) error {
67- if err := cn .netConn .SetReadDeadline (cn .deadline (ctx , timeout )); err != nil {
68- return err
67+ if timeout != 0 {
68+ if err := cn .netConn .SetReadDeadline (cn .deadline (ctx , timeout )); err != nil {
69+ return err
70+ }
6971 }
7072 return fn (cn .rd )
7173}
7274
7375func (cn * Conn ) WithWriter (
7476 ctx context.Context , timeout time.Duration , fn func (wr * proto.Writer ) error ,
7577) error {
76- if err := cn .netConn .SetWriteDeadline (cn .deadline (ctx , timeout )); err != nil {
77- return err
78+ if timeout != 0 {
79+ if err := cn .netConn .SetWriteDeadline (cn .deadline (ctx , timeout )); err != nil {
80+ return err
81+ }
7882 }
7983
8084 if cn .bw .Buffered () > 0 {
You can’t perform that action at this time.
0 commit comments