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 {
64
64
}
65
65
66
66
func (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
+ }
69
71
}
70
72
return fn (cn .rd )
71
73
}
72
74
73
75
func (cn * Conn ) WithWriter (
74
76
ctx context.Context , timeout time.Duration , fn func (wr * proto.Writer ) error ,
75
77
) 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
+ }
78
82
}
79
83
80
84
if cn .bw .Buffered () > 0 {
You can’t perform that action at this time.
0 commit comments