evennia.server.portal.amp_server¶
The Evennia Portal service acts as an AMP-server, handling AMP communication to the AMP clients connecting to it (by default these are the Evennia Server and the evennia launcher).
-
evennia.server.portal.amp_server.
getenv
()[source]¶ Get current environment and add PYTHONPATH.
- Returns
env (dict) – Environment global dict.
-
class
evennia.server.portal.amp_server.
AMPServerFactory
(portal)[source]¶ Bases:
twisted.internet.protocol.ServerFactory
This factory creates AMP Server connection. This acts as the ‘Portal’-side communication to the ‘Server’ process.
-
noisy
= False¶
-
-
class
evennia.server.portal.amp_server.
AMPServerProtocol
(*args, **kwargs)[source]¶ Bases:
evennia.server.portal.amp.AMPMultiConnectionProtocol
Protocol subclass for the AMP-server run by the Portal.
-
connectionLost
(reason)[source]¶ Set up a simple callback mechanism to let the amp-server wait for a connection to close.
-
get_status
()[source]¶ Return status for the Evennia infrastructure.
- Returns
status (tuple) –
- The portal/server status and pids
(portal_live, server_live, portal_PID, server_PID).
-
data_to_server
(command, sessid, **kwargs)[source]¶ Send data across the wire to the Server.
- Parameters
command (AMP Command) – A protocol send command.
sessid (int) – A unique Session id.
kwargs (any) – Data to send. This will be pickled.
- Returns
deferred (deferred or None) – A deferred with an errback.
Notes
Data will be sent across the wire pickled as a tuple (sessid, kwargs).
-
start_server
(server_twistd_cmd)[source]¶ (Re-)Launch the Evennia server.
- Parameters
server_twisted_cmd (list) – The server start instruction to pass to POpen to start the server.
-
wait_for_disconnect
(callback, *args, **kwargs)[source]¶ Add a callback for when this connection is lost.
-
wait_for_server_connect
(callback, *args, **kwargs)[source]¶ Add a callback for when the Server is sure to have connected.
-
stop_server
(mode='shutdown')[source]¶ Shut down server in one or more modes.
- Parameters
mode (str) – One of ‘shutdown’, ‘reload’ or ‘reset’.
-
send_MsgPortal2Server
(session, **kwargs)[source]¶ Access method called by the Portal and executed on the Portal.
- Parameters
session (session) – Session
kwargs (any, optional) – Optional data.
- Returns
deferred (Deferred) – Asynchronous return.
-
send_AdminPortal2Server
(session, operation='', **kwargs)[source]¶ Send Admin instructions from the Portal to the Server. Executed on the Portal.
- Parameters
session (Session) – Session.
operation (char, optional) – Identifier for the server operation, as defined by the global variables in evennia/server/amp.py.
data (str or dict, optional) – Data used in the administrative operation.
-
portal_receive_status
()¶ Helper decorator
-
portal_receive_launcher2portal
()¶ Helper decorator
-
portal_receive_server2portal
()¶ Helper decorator
-
portal_receive_adminserver2portal
()¶ Helper decorator
-