Set AMP interface strings to listen to local interfaces only by default. Also added AMP_INTERFACE setting. Resolves Issue 257.

This commit is contained in:
Griatch 2012-09-28 22:40:12 +02:00
parent ed60c3046f
commit 3c87b66624
4 changed files with 8 additions and 5 deletions

View file

@ -154,8 +154,6 @@ if AMP_ENABLED:
# the portal and the mud server. Only reason to ever deactivate
# it would be during testing and debugging.
print " amp (to Server): %s" % AMP_PORT
from src.server import amp
factory = amp.AmpClientFactory(PORTAL)

View file

@ -55,6 +55,7 @@ VERSION = get_evennia_version()
AMP_ENABLED = True
AMP_HOST = settings.AMP_HOST
AMP_PORT = settings.AMP_PORT
AMP_INTERFACE = settings.AMP_INTERFACE
# server-channel mappings
IMC2_ENABLED = settings.IMC2_ENABLED
@ -306,12 +307,15 @@ if AMP_ENABLED:
# the portal and the mud server. Only reason to ever deactivate
# it would be during testing and debugging.
print ' amp (to Portal): %s' % AMP_PORT
ifacestr = ""
if AMP_INTERFACE != '127.0.0.1':
ifacestr = "-%s" % AMP_INTERFACE
print ' amp (to Portal)%s:%s' % (ifacestr, AMP_PORT)
from src.server import amp
factory = amp.AmpServerFactory(EVENNIA)
amp_service = internet.TCPServer(AMP_PORT, factory)
amp_service = internet.TCPServer(AMP_PORT, factory, interface=AMP_INTERFACE)
amp_service.setName("EvenniaPortal")
EVENNIA.services.addService(amp_service)

View file

@ -110,6 +110,7 @@ ENCODINGS = ["utf-8", "latin-1", "ISO-8859-1"]
# change this unless you cannot use the default AMP port/host for whatever reason.
AMP_HOST = 'localhost'
AMP_PORT = 5000
AMP_INTERFACE = '127.0.0.1'
# Attributes on objects are cached aggressively for speed. If the number of
# objects is large (and their attributes are often accessed) this can use up a lot of
# memory. So every now and then Evennia checks the size of this cache and resets