epmd¶
An Erlang Port Mapper Daemon (EPMD) server on asyncio.
Epmd is the server; EpmdProtocol handles one client
connection.
- class epmd.Epmd(host=None, port=4369, *, addresses=None, packet_timeout=60.0, relaxed_command_check=False, max_connections=1024)¶
Bases:
objectListens on the EPMD protocol port and handles discovery of running Erlang nodes on this host.
- EPMD_DEFAULT_PORT = 4369¶
- DEFAULT_PACKET_TIMEOUT = 60.0¶
- DEFAULT_MAX_CONNECTIONS = 1024¶
- async start()¶
Start listening and return once the socket listens.
Afterwards
self.portis the bound port (useful withport=0; every address then gets the port the first one got).
- async stop()¶
Stop listening and close every client connection. Registered nodes are forgotten. Calling it again, or before
start, is safe.
- async start_server()¶
Start listening and serve until cancelled or stopped (
stop()or a KILL_REQ); then stop.- Raises:
OSError – the port is in use, typically by another EPMD.
- register(node_name, data)¶
Attempts to register a node. Returns True if successful, False if the node is already registered.
Sets
data.cr_counter: one more than at the name’s previous registration if it is remembered, else a random start.
- unregister(node_name)¶
Called from EpmdProtocol when a client disconnects or when a STOP command arrives (documentation claims this is not used but still implemented). Removes the node from the list of nodes.
- class epmd.EpmdProtocol(parent)¶
Bases:
ProtocolOne client connection of the EPMD server.
As in OTP’s epmd, a connection carries exactly one request. It is closed after the reply, except after a successful ALIVE2_REQ: then it stays open, and the node is unregistered when it closes or sends anything more. Malformed requests close the connection without a reply.
- EPMD_ALIVE2_REQ = 120¶
- EPMD_PORT2_REQ = 122¶
- EPMD_PORT_PLEASE2_REQ = 122¶
- EPMD_NAMES_REQ = 110¶
- EPMD_KILL_REQ = 107¶
- EPMD_DUMP_REQ = 100¶
- EPMD_STOP_REQ = 115¶
- ALIVE_NORMAL_NODE_TYPE = 77¶
- ALIVE_HIDDEN_NODE_TYPE = 72¶
- connection_lost(exc)¶
The client closed the connection: a node registered on it is unregistered.
- connection_made(transport)¶
Connection has been accepted and established (callback).
- data_received(data)¶
Collect the client’s bytes; answer once the one request of the connection is complete.
- on_packet(packet)¶
Answer one request body (without the length prefix).
- Raises:
EpmdRequestError – the request is malformed.
Modules
A node as the server knows it. |
|
One client connection of the server. |
|
EPMD requests and replies as pure functions over |
|
The EPMD server and its table of registered nodes. |
|
Exceptions of the |