File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -400,17 +400,14 @@ def _send_bytes(self, buf):
400400 if n > 16384 :
401401 # The payload is large so Nagle's algorithm won't be triggered
402402 # and we'd better avoid the cost of concatenation.
403- chunks = [header , buf ]
404- elif n > 0 :
403+ self ._send (header )
404+ self ._send (buf )
405+ else :
405406 # Issue # 20540: concatenate before sending, to avoid delays due
406407 # to Nagle's algorithm on a TCP socket.
407- chunks = [header + buf ]
408- else :
409- # This code path is necessary to avoid "broken pipe" errors
410- # when sending a 0-length buffer if the other end closed the pipe.
411- chunks = [header ]
412- for chunk in chunks :
413- self ._send (chunk )
408+ # Also note we want to avoid sending a 0-length buffer separately,
409+ # to avoid "broken pipe" errors if the other end closed the pipe.
410+ self ._send (header + buf )
414411
415412 def _recv_bytes (self , maxsize = None ):
416413 buf = self ._recv (4 )
You can’t perform that action at this time.
0 commit comments