MCPcopy Index your code
hub / github.com/python/cpython / _send_bytes

Method _send_bytes

Lib/multiprocessing/connection.py:424–445  ·  view source on GitHub ↗
(self, buf)

Source from the content-addressed store, hash-verified

422 return buf
423
424 def _send_bytes(self, buf):
425 n = len(buf)
426 if n > 0x7fffffff:
427 pre_header = struct.pack("!i", -1)
428 header = struct.pack("!Q", n)
429 self._send(pre_header)
430 self._send(header)
431 self._send(buf)
432 else:
433 # For wire compatibility with 3.7 and lower
434 header = struct.pack("!i", n)
435 if n > 16384:
436 # The payload is large so Nagle's algorithm won't be triggered
437 # and we'd better avoid the cost of concatenation.
438 self._send(header)
439 self._send(buf)
440 else:
441 # Issue #20540: concatenate before sending, to avoid delays due
442 # to Nagle's algorithm on a TCP socket.
443 # Also note we want to avoid sending a 0-length buffer separately,
444 # to avoid "broken pipe" errors if the other end closed the pipe.
445 self._send(header + buf)
446
447 def _recv_bytes(self, maxsize=None):
448 buf = self._recv(4)

Callers 2

send_bytesMethod · 0.45
sendMethod · 0.45

Calls 2

_sendMethod · 0.95
packMethod · 0.45

Tested by

no test coverage detected