MCPcopy
hub / github.com/benoitc/gunicorn / write_message

Method write_message

gunicorn/dirty/protocol.py:560–573  ·  view source on GitHub ↗

Write a message to socket (sync). Args: sock: Socket to write to message: Message dict with 'type', 'id', and payload fields Raises: DirtyProtocolError: If encoding fails OSError: If write fails

(sock: socket.socket, message: dict)

Source from the content-addressed store, hash-verified

558
559 @staticmethod
560 def write_message(sock: socket.socket, message: dict) -> None:
561 """
562 Write a message to socket (sync).
563
564 Args:
565 sock: Socket to write to
566 message: Message dict with 'type', 'id', and payload fields
567
568 Raises:
569 DirtyProtocolError: If encoding fails
570 OSError: If write fails
571 """
572 data = BinaryProtocol._encode_from_dict(message)
573 sock.sendall(data)
574
575 @staticmethod
576 def _encode_from_dict(message: dict) -> bytes: # pylint: disable=too-many-return-statements

Callers 3

_execute_lockedMethod · 0.45
_start_requestMethod · 0.45
_executeMethod · 0.45

Calls 2

_encode_from_dictMethod · 0.80
sendallMethod · 0.45

Tested by

no test coverage detected