File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -64,21 +64,17 @@ 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 timeout != 0 {
68- if err := cn .netConn .SetReadDeadline (cn .deadline (ctx , timeout )); err != nil {
69- return err
70- }
67+ if err := cn .netConn .SetReadDeadline (cn .deadline (ctx , timeout )); err != nil {
68+ return err
7169 }
7270 return fn (cn .rd )
7371}
7472
7573func (cn * Conn ) WithWriter (
7674 ctx context.Context , timeout time.Duration , fn func (wr * proto.Writer ) error ,
7775) error {
78- if timeout != 0 {
79- if err := cn .netConn .SetWriteDeadline (cn .deadline (ctx , timeout )); err != nil {
80- return err
81- }
76+ if err := cn .netConn .SetWriteDeadline (cn .deadline (ctx , timeout )); err != nil {
77+ return err
8278 }
8379
8480 if cn .bw .Buffered () > 0 {
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ type Options struct {
7676 // Default is 3 seconds.
7777 ReadTimeout time.Duration
7878 // Timeout for socket writes. If reached, commands will fail
79- // with a timeout instead of blocking.
79+ // with a timeout instead of blocking. Use value -1 for no timeout and 0 for default.
8080 // Default is ReadTimeout.
8181 WriteTimeout time.Duration
8282
You can’t perform that action at this time.
0 commit comments