changeset 224:f6a900294f62

runpysmcl: linearizing.
author Sigurd Meldgaard <stm@daimi.au.dk>
date Wed, 23 Dec 2009 14:42:18 +0100
parents 092189a2b2df
children cf5adacbea25
files pysmcl/runpysmcl.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/runpysmcl.py	Wed Dec 23 14:41:29 2009 +0100
+++ b/pysmcl/runpysmcl.py	Wed Dec 23 14:42:18 2009 +0100
@@ -1,12 +1,18 @@
 from optparse import OptionParser
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks
+import twisted.internet.defer
 
 from viff.config import load_config
 from viff.comparison import ComparisonToft05Mixin
 from viff.runtime import Runtime, create_runtime, make_runtime_class
 
 
+def callback(self, result):
+    self._startRunCallbacks(result)
+
+twisted.internet.defer.Deferred.callback = callback
+
 parser = OptionParser(usage="Usage: %prog [options] pysmcl_program config_file")
 parser.add_option("-a", "--active", action="store_true", help="Use actively "
                   "secure runtime. Default is only passive security.")
@@ -14,8 +20,6 @@
 
 (options, args) = parser.parse_args()
 
-print args # TODO remove
-
 if len(args) < 2:
     parser.error("Not enough arguments")
 
@@ -35,11 +39,12 @@
 
 exec open(args[0]) in program_module
 
+@inlineCallbacks
 def protocol(runtime):
     yield program_module["main"](runtime)
     yield runtime.synchronize()
     yield runtime.shutdown()
 
-pre_runtime.addCallback(inlineCallbacks(protocol))
+pre_runtime.addCallback(protocol)
 
 reactor.run()