File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package rueidis
33import (
44 "bufio"
55 "context"
6+ "crypto/tls"
67 "errors"
78 "fmt"
89 "io"
@@ -321,10 +322,19 @@ func (p *pipe) _exit(err error) {
321322 p .clhks .Load ().(func (error ))(err )
322323}
323324
325+ func disableNoDelay (conn net.Conn ) {
326+ if c , ok := conn .(* tls.Conn ); ok {
327+ conn = c .NetConn ()
328+ }
329+ if c , ok := conn .(* net.TCPConn ); ok {
330+ c .SetNoDelay (false )
331+ }
332+ }
333+
324334func (p * pipe ) _background () {
325335 p .conn .SetDeadline (time.Time {})
326- if conn , ok := p . conn .( * net. TCPConn ); ok && p .noNoDelay {
327- conn . SetNoDelay ( false )
336+ if p .noNoDelay {
337+ disableNoDelay ( p . conn )
328338 }
329339 go func () {
330340 p ._exit (p ._backgroundWrite ())
Original file line number Diff line number Diff line change @@ -302,8 +302,9 @@ func TestTLSClient(t *testing.T) {
302302
303303 _ , port , _ := net .SplitHostPort (ln .Addr ().String ())
304304 client , err := NewClient (ClientOption {
305- InitAddress : []string {"127.0.0.1:" + port },
306- TLSConfig : config ,
305+ InitAddress : []string {"127.0.0.1:" + port },
306+ TLSConfig : config ,
307+ DisableTCPNoDelay : true ,
307308 })
308309 if err != nil {
309310 t .Fatal (err )
You can’t perform that action at this time.
0 commit comments