X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fserver%2Fsfaserver.py;h=1fec2c068aa8ff5e89eaaf397d1be803d73b4b96;hb=HEAD;hp=8873e86e6d71b17697c340295860dc95132fae94;hpb=d7783df8ee22afb550dcd6916c8ac47a67bd9fe8;p=sfa.git diff --git a/sfa/server/sfaserver.py b/sfa/server/sfaserver.py index 8873e86e..1fec2c06 100644 --- a/sfa/server/sfaserver.py +++ b/sfa/server/sfaserver.py @@ -1,10 +1,8 @@ -## -# This module implements a general-purpose server layer for sfa. -# The same basic server should be usable on the registry, component, or -# other interfaces. -# -# TODO: investigate ways to combine this with existing PLC server? -## +""" +This module implements a general-purpose server layer for sfa. +The same basic server should be usable on the registry or +other interfaces. +""" import threading @@ -12,8 +10,6 @@ from sfa.server.threadedserver import ThreadedServer, SecureXMLRpcRequestHandler from sfa.util.sfalogging import logger from sfa.trust.certificate import Keypair, Certificate -#should be passed to threadedserver -#from sfa.plc.api import SfaAPI ## # Implements an HTTPS XML-RPC server. Generally it is expected that SFA @@ -22,6 +18,7 @@ from sfa.trust.certificate import Keypair, Certificate # the credential, and verify that the user is using the key that matches the # GID supplied in the credential. + class SfaServer(threading.Thread): ## @@ -30,19 +27,20 @@ class SfaServer(threading.Thread): # @param ip the ip address to listen on # @param port the port to listen on # @param key_file private key filename of registry - # @param cert_file certificate filename containing public key + # @param cert_file certificate filename containing public key # (could be a GID file) - def __init__(self, ip, port, key_file, cert_file,interface): + def __init__(self, ip, port, key_file, cert_file, interface): threading.Thread.__init__(self) - self.key = Keypair(filename = key_file) - self.cert = Certificate(filename = cert_file) + self.key = Keypair(filename=key_file) + self.cert = Certificate(filename=cert_file) #self.server = SecureXMLRPCServer((ip, port), SecureXMLRpcRequestHandler, key_file, cert_file) - self.server = ThreadedServer((ip, port), SecureXMLRpcRequestHandler, key_file, cert_file) - self.server.interface=interface + self.server = ThreadedServer( + (ip, int(port)), SecureXMLRpcRequestHandler, key_file, cert_file) + self.server.interface = interface self.trusted_cert_list = None self.register_functions() - logger.info("Starting SfaServer, interface=%s"%interface) + logger.info("Starting SfaServer, interface=%s" % interface) ## # Register functions that will be served by the XMLRPC server. This @@ -56,13 +54,10 @@ class SfaServer(threading.Thread): # that was passed to it. def noop(self, cred, anything): - self.decode_authentication(cred) return anything ## - # Execute the server, serving requests forever. + # Execute the server, serving requests forever. def run(self): self.server.serve_forever() - -