dist.base_dist_protocol module¶
Base abstract Distribution connection class
-
class
pyrlang.dist.base_dist_protocol.
BaseDistProtocol
(node_name: str, engine: pyrlang.async_support.base_engine.BaseEngine)¶ Bases:
pyrlang.async_support.base_protocol.BaseProtocol
Defines Erlang distribution protocol.
-
ALIVE
= 'alive'¶
-
CONNECTED
= 'conn'¶
-
DISCONNECTED
= 'disconn'¶
-
RECV_CHALLENGE
= 'recv_challenge'¶
-
RECV_CHALLENGE_ACK
= 'recv_challenge_ack'¶
-
RECV_NAME
= 'recvname'¶
-
RECV_STATUS
= 'recv_status'¶
-
WAIT_CHALLENGE_REPLY
= 'wait_ch_reply'¶
-
static
check_digest
(digest: bytes, challenge: int, cookie: str) → bool¶ Hash cookie + the challenge together producing a verification hash and return if they match against the offered 'digest'.
-
engine_
= None¶ Save engine object, to use for our async needs later.
-
get_node
()¶ Use this to get access to the Pyrlang node which owns this protocol. :rtype: pyrlang.node.Node
-
inbox_
= None¶ Inbox is used to ask the connection to do something.
-
static
make_digest
(challenge: int, cookie: str) → bytes¶
-
node_db
= <pyrlang.bases.NodeDB object>¶
-
node_name_
= None¶ Reference to the running Erlang node. (XXX forms a ref cycle)
-
on_connected
(host_port)¶ Handler invoked from the recv loop (in
util.make_handler_in
) when the connection has been accepted and established.
-
on_connection_lost
()¶ Handler is called when the client has disconnected
-
on_incoming_data
(data: bytes) → Optional[bytes]¶ Attempt to consume first part of data as a packet
Parameters: data -- The accumulated data from the socket which we try to partially or fully consume Returns: Unconsumed data, incomplete following packet maybe or nothing. Returning None requests to close the connection
-
on_packet
(data: bytes) → bool¶
-
on_packet_connected
(data)¶ Handle incoming dist packets in the connected state.
-
on_passthrough_message
(control_term, msg_term)¶ On incoming 'p' message with control and data, handle it. :raises DistributionError: when 'p' message is not a tuple
-
packet_len_size_
= None¶ Packet size header is variable, 2 bytes before handshake is finished and 4 bytes afterwards.
-
peer_distr_version_
= None¶ Protocol version range supported by the remote peer. Erlang/OTP versions 19-20 supports protocol version 7, older Erlangs down to R6B support version 5.
-
periodic_check
()¶ Override this to do periodic checks on something.
-
protocol_error
(msg) → bool¶
-
report_dist_connected
()¶
-
state_
= None¶ FSM state for the protocol state-machine.
-
-
exception
pyrlang.dist.base_dist_protocol.
DistributionError
(msg, *args, **kwargs)¶ Bases:
Exception