Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r197 - in branches/stateengine/src: . common

Project highlights: Stable Version: 1.6.1, Development Version: 1.7.6

current
Discussion topic

Back to topic list

svn commit: r197 - in branches/stateengine/src: . common

Reply

Author jjneely
Full name Jack Neely
Date 2005-09-02 14:10:43 PDT
Message Author: jjneely
Date: Fri Sep 2 14:10:42 2005
New Revision: 197

Added:
   branches/stateengine​/src/common/xmlrpc.p​y
Modified:
   branches/stateengine​/src/client.py
   branches/stateengine​/src/server.py
Log:
Add my own xmlrpc server class and start adding some additional features
there.

The server needs a mostly authoritative way to know what or who the client
is. This is now referencable as well.


Modified: branches/stateengine​/src/client.py
Url: http://current.tigri​s.org/source/browse/​current/branches/sta​teengine/src/client.​py?view=diff&rev​=197&p1=branches​/stateengine/src/cli​ent.py&r1=196​&p2=branches/statee​ngine/src/client.py​&r2=197
====================​====================​====================​==================
--- branches/stateengine​/src/client.py (original)
+++ branches/stateengine​/src/client.py Fri Sep 2 14:10:42 2005
@@ -1,8 +1,8 @@
 #!/usr/bin/python
 
-import SimpleXMLRPCServer
 from common import modules
 from common import prototypes
+from common import xmlrpc
 
 # Port the client listens on
 port = 5740
@@ -28,7 +28,7 @@
 def startClient():
     client = ClientServer()
 
- testServer = SimpleXMLRPCServer.S​impleXMLRPCServer(("​localhost", port))
+ testServer = xmlrpc.Server("localhost", port)
     testServer.register_​instance(client)
 
     try:

Added: branches/stateengine​/src/common/xmlrpc.p​y
Url: http://current.tigri​s.org/source/browse/​current/branches/sta​teengine/src/common/​xmlrpc.py?view=auto​&rev=197
====================​====================​====================​==================
--- (empty file)
+++ branches/stateengine​/src/common/xmlrpc.p​y Fri Sep 2 14:10:42 2005
@@ -0,0 +1,19 @@
+import SimpleXMLRPCServer
+import string
+import socket
+
+# Stolen from
+# http://aspn.activest​ate.com/ASPN/Cookboo​k/Python/Recipe/1653​75
+
+class Server(SimpleXMLRPCS​erver.SimpleXMLRPCSe​rver):
+
+ def __init__(self, *args):
+ SimpleXMLRPCServer.S​impleXMLRPCServer.__​init__(self,(args[0]​,args[1]))
+
+ def server_bind(self):
+ self.socket.setsocko​pt(socket.SOL_SOCKET​, socket.SO_REUSEADDR, 1)
+ SimpleXMLRPCServer.S​impleXMLRPCServer.se​rver_bind(self)
+
+ def verify_request(self, request, client_address):
+ self.client_address = client_address
+ return True

Modified: branches/stateengine​/src/server.py
Url: http://current.tigri​s.org/source/browse/​current/branches/sta​teengine/src/server.​py?view=diff&rev​=197&p1=branches​/stateengine/src/ser​ver.py&r1=196​&p2=branches/statee​ngine/src/server.py​&r2=197
====================​====================​====================​==================
--- branches/stateengine​/src/server.py (original)
+++ branches/stateengine​/src/server.py Fri Sep 2 14:10:42 2005
@@ -1,9 +1,9 @@
 #!/usr/bin/python
 import ConfigParser
-import SimpleXMLRPCServer
 import xmlrpclib
 from common import modules
 from common import prototypes
+from common import xmlrpc
 import os
 import sys
 import time
@@ -73,11 +73,11 @@
 class RPCAPI(object):
     
     def __init__(self):
- pass
+ self.rpcserver = None
         
        
     def identity(self, text):
- return text
+ return self.rpcserver.client_address
 
 
     def get(self, host):
@@ -96,8 +96,10 @@
 
 
     def run(self):
- testServer = SimpleXMLRPCServer.S​impleXMLRPCServer(("​localhost", port))
+ testServer = xmlrpc.Server("localhost", port)
         testServer.register_​instance(self.api)
+ self.api.rpcserver = testServer
+
         testServer.serve_forever()

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r197 - in branches/stateengine/src: . common jjneely Jack Neely 2005-09-02 14:10:43 PDT
Messages per page: