MCPcopy Index your code
hub / github.com/RustPython/RustPython / _send_bytes

Method _send_bytes

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

Source from the content-addressed store, hash-verified

404 return buf
405
406 def _send_bytes(self, buf):
407 n = len(buf)
408 if n > 0x7fffffff:
409 pre_header = struct.pack("!i", -1)
410 header = struct.pack("!Q", n)
411 self._send(pre_header)
412 self._send(header)
413 self._send(buf)
414 else:
415 # For wire compatibility with 3.7 and lower
416 header = struct.pack("!i", n)
417 if n > 16384:
418 # The payload is large so Nagle's algorithm won't be triggered
419 # and we'd better avoid the cost of concatenation.
420 self._send(header)
421 self._send(buf)
422 else:
423 # Issue #20540: concatenate before sending, to avoid delays due
424 # to Nagle's algorithm on a TCP socket.
425 # Also note we want to avoid sending a 0-length buffer separately,
426 # to avoid "broken pipe" errors if the other end closed the pipe.
427 self._send(header + buf)
428
429 def _recv_bytes(self, maxsize=None):
430 buf = self._recv(4)

Callers 2

send_bytesMethod · 0.45
sendMethod · 0.45

Calls 3

_sendMethod · 0.95
lenFunction · 0.85
packMethod · 0.45

Tested by

no test coverage detected