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()[源代码]

Get current environment and add PYTHONPATH.

返回

env (dict) – Environment global dict.

class evennia.server.portal.amp_server.AMPServerFactory(portal)[源代码]

基类:twisted.internet.protocol.ServerFactory

This factory creates AMP Server connection. This acts as the ‘Portal’-side communication to the ‘Server’ process.

noisy = False
logPrefix()[源代码]

How this is named in logs

__init__(portal)[源代码]

Initialize the factory. This is called as the Portal service starts.

参数
  • portal (Portal) – The Evennia Portal service instance.

  • protocol (Protocol) – The protocol the factory creates instances of.

buildProtocol(addr)[源代码]

Start a new connection, and store it on the service object.

参数

addr (str) – Connection address. Not used.

返回

protocol (Protocol) – The created protocol.

class evennia.server.portal.amp_server.AMPServerProtocol(*args, **kwargs)[源代码]

基类:evennia.server.portal.amp.AMPMultiConnectionProtocol

Protocol subclass for the AMP-server run by the Portal.

connectionLost(reason)[源代码]

Set up a simple callback mechanism to let the amp-server wait for a connection to close.

get_status()[源代码]

Return status for the Evennia infrastructure.

返回

status (tuple)

The portal/server status and pids

(portal_live, server_live, portal_PID, server_PID).

data_to_server(command, sessid, **kwargs)[源代码]

Send data across the wire to the Server.

参数
  • command (AMP Command) – A protocol send command.

  • sessid (int) – A unique Session id.

  • kwargs (any) – Data to send. This will be pickled.

返回

deferred (deferred or None) – A deferred with an errback.

提示

Data will be sent across the wire pickled as a tuple (sessid, kwargs).

start_server(server_twistd_cmd)[源代码]

(Re-)Launch the Evennia server.

参数

server_twisted_cmd (list) – The server start instruction to pass to POpen to start the server.

wait_for_disconnect(callback, *args, **kwargs)[源代码]

Add a callback for when this connection is lost.

参数

callback (callable) – Will be called with *args, **kwargs once this protocol is disconnected.

wait_for_server_connect(callback, *args, **kwargs)[源代码]

Add a callback for when the Server is sure to have connected.

参数

callback (callable) – Will be called with *args, **kwargs once the Server handshake with Portal is complete.

stop_server(mode='shutdown')[源代码]

Shut down server in one or more modes.

参数

mode (str) – One of ‘shutdown’, ‘reload’ or ‘reset’.

send_Status2Launcher()[源代码]

Send a status stanza to the launcher.

send_MsgPortal2Server(session, **kwargs)[源代码]

Access method called by the Portal and executed on the Portal.

参数
  • session (session) – Session

  • kwargs (any, optional) – Optional data.

返回

deferred (Deferred) – Asynchronous return.

send_AdminPortal2Server(session, operation='', **kwargs)[源代码]

Send Admin instructions from the Portal to the Server. Executed on the Portal.

参数
  • 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