1
0
Fork 0

add IPv6 support to gvaserver (fixes #30)

This commit is contained in:
Jan Dittberner 2009-07-18 20:23:03 +02:00
parent 92c1e21f32
commit 483c1f9038

View file

@ -21,14 +21,16 @@
# #
# Version: $Id$ # Version: $Id$
import sys, os, logging.config import sys, os, logging.config, socket
from gnuviechadmin.util.passwordutils import md5_crypt_password from gnuviechadmin.util.passwordutils import md5_crypt_password
from SimpleXMLRPCServer import SimpleXMLRPCServer
logcfgs = ('gnuviechadmin/logging.cfg', '/etc/gnuviechadmin/logging.cfg', logcfgs = ('gnuviechadmin/logging.cfg', '/etc/gnuviechadmin/logging.cfg',
os.path.expanduser('~/.gva-logging.cfg')) os.path.expanduser('~/.gva-logging.cfg'))
for cfg in [x for x in logcfgs if os.path.exists(x)]: for cfg in [x for x in logcfgs if os.path.exists(x)]:
logging.config.fileConfig(cfg) logging.config.fileConfig(cfg)
def usage(): def usage():
print """%s <host> <port> print """%s <host> <port>
@ -36,12 +38,22 @@ where host and port specify the connection parameters. Host is the
hostname or ip address to listen on. hostname or ip address to listen on.
""" % sys.argv[0] """ % sys.argv[0]
class GnuviechAdminXMLRPCServer(SimpleXMLRPCServer):
def __init__(self, server_address, **kwargs):
try:
SimpleXMLRPCServer.__init__(self, server_address, **kwargs)
except socket.gaierror, e:
self.address_family = socket.AF_INET6
SimpleXMLRPCServer.__init__(self, server_address, **kwargs)
def main(): def main():
if (sys.argv.__len__() < 3): if (sys.argv.__len__() < 3):
usage() usage()
sys.exit() sys.exit()
from SimpleXMLRPCServer import SimpleXMLRPCServer server = GnuviechAdminXMLRPCServer((sys.argv[1], int(sys.argv[2])),
server = SimpleXMLRPCServer(("localhost", 9999), allow_none=True) allow_none=True)
server.register_introspection_functions() server.register_introspection_functions()
from gnuviechadmin.xmlrpc import XMLRPCFacade from gnuviechadmin.xmlrpc import XMLRPCFacade