viff

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 diff
     1.1 --- a/viff/runtime.py	Tue Oct 14 15:06:43 2008 +0200
     1.2 +++ b/viff/runtime.py	Tue Oct 14 15:48:42 2008 +0200
     1.3 @@ -41,7 +41,7 @@
     1.4  from viff import shamir
     1.5  from viff.prss import prss, prss_lsb, prss_zero
     1.6  from viff.field import GF256, FieldElement
     1.7 -from viff.util import wrapper, rand, profile
     1.8 +from viff.util import wrapper, rand, profile, deep_wait
     1.9  
    1.10  from twisted.internet import reactor
    1.11  from twisted.internet.error import ConnectionDone, CannotListenError
    1.12 @@ -643,17 +643,6 @@
    1.13              # We concatenate the sub-lists in results.
    1.14              results = sum(results, [])
    1.15  
    1.16 -            wait_list = []
    1.17 -            for result in results:
    1.18 -                # We allow pre-processing methods to return tuples of
    1.19 -                # shares or individual shares as their result. Here we
    1.20 -                # deconstruct result (if possible) and wait on its
    1.21 -                # individual parts.
    1.22 -                if isinstance(result, tuple):
    1.23 -                    wait_list.extend(result)
    1.24 -                else:
    1.25 -                    wait_list.append(result)
    1.26 -
    1.27              # The pool must map program counters to Deferreds to
    1.28              # present a uniform interface for the functions we
    1.29              # pre-process.
    1.30 @@ -661,10 +650,11 @@
    1.31  
    1.32              # Update the pool with pairs of program counter and data.
    1.33              self._pool.update(zip(program_counters, results))
    1.34 +
    1.35              # Return a Deferred that waits on the individual results.
    1.36              # This is important to make it possible for the players to
    1.37              # avoid starting before the pre-processing is complete.
    1.38 -            return gatherResults(wait_list)
    1.39 +            return deep_wait(results)
    1.40  
    1.41          wait_list = []
    1.42          for ((generator, args), program_counters) in program.iteritems():