changeset 1000:7546e47ce876

Use deep_wait when preprocessing.
author Martin Geisler <mg@daimi.au.dk>
date Tue, 14 Oct 2008 15:48:42 +0200
parents 23a883d5a4b3
children 74bcf4955f99
files viff/runtime.py
diffstat 1 files changed, 3 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/viff/runtime.py	Tue Oct 14 15:06:43 2008 +0200
+++ b/viff/runtime.py	Tue Oct 14 15:48:42 2008 +0200
@@ -41,7 +41,7 @@
 from viff import shamir
 from viff.prss import prss, prss_lsb, prss_zero
 from viff.field import GF256, FieldElement
-from viff.util import wrapper, rand, profile
+from viff.util import wrapper, rand, profile, deep_wait
 
 from twisted.internet import reactor
 from twisted.internet.error import ConnectionDone, CannotListenError
@@ -643,17 +643,6 @@
             # We concatenate the sub-lists in results.
             results = sum(results, [])
 
-            wait_list = []
-            for result in results:
-                # We allow pre-processing methods to return tuples of
-                # shares or individual shares as their result. Here we
-                # deconstruct result (if possible) and wait on its
-                # individual parts.
-                if isinstance(result, tuple):
-                    wait_list.extend(result)
-                else:
-                    wait_list.append(result)
-
             # The pool must map program counters to Deferreds to
             # present a uniform interface for the functions we
             # pre-process.
@@ -661,10 +650,11 @@
 
             # Update the pool with pairs of program counter and data.
             self._pool.update(zip(program_counters, results))
+
             # Return a Deferred that waits on the individual results.
             # This is important to make it possible for the players to
             # avoid starting before the pre-processing is complete.
-            return gatherResults(wait_list)
+            return deep_wait(results)
 
         wait_list = []
         for ((generator, args), program_counters) in program.iteritems():