Refactoring in progress...
[nodemanager.git] / api.py
diff --git a/api.py b/api.py
index 73f38e7..97d35d9 100644 (file)
--- a/api.py
+++ b/api.py
@@ -9,13 +9,15 @@ import struct
 import threading
 import xmlrpclib
 
-from config import *
 import accounts
 import database
 import logger
 import tools
 
 
+API_SERVER_PORT = 812
+
+
 api_method_dict = {}
 nargs_dict = {}
 
@@ -112,6 +114,7 @@ class APIRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
         if len(args) != nargs_dict[method_name]:
             raise xmlrpclib.Fault(101, 'Invalid argument count: got %d, expecting %d.' % (len(args), expected_nargs))
         else:
+            # Figure out who's calling.
             # XXX - these ought to be imported directly from some .h file
             SO_PEERCRED = 17
             sizeof_struct_ucred = 12
@@ -143,6 +146,7 @@ class APIServer_INET(SocketServer.ThreadingMixIn,
 class APIServer_UNIX(APIServer_INET): address_family = socket.AF_UNIX
 
 def start():
+    """Start two XMLRPC interfaces: one bound to localhost, the other bound to a Unix domain socket."""
     serv1 = APIServer_INET(('127.0.0.1', API_SERVER_PORT),
                            requestHandler=APIRequestHandler, logRequests=0)
     tools.as_daemon_thread(serv1.serve_forever)