diff -r 3110fb3095a2 Lib/multiprocessing/connection.py --- a/Lib/multiprocessing/connection.py Sun Feb 09 13:46:20 2014 +0200 +++ b/Lib/multiprocessing/connection.py Sun Feb 09 14:16:55 2014 +0200 @@ -401,17 +401,12 @@ if n > 16384: # The payload is large so Nagle's algorithm won't be triggered # and we'd better avoid the cost of concatenation. - chunks = [header, buf] - elif n > 0: + self._send(header) + self._send(buf) + else: # Issue # 20540: concatenate before sending, to avoid delays due # to Nagle's algorithm on a TCP socket. - chunks = [header + buf] - else: - # This code path is necessary to avoid "broken pipe" errors - # when sending a 0-length buffer if the other end closed the pipe. - chunks = [header] - for chunk in chunks: - self._send(chunk) + self._send(header + buf) def _recv_bytes(self, maxsize=None): buf = self._recv(4)