/rev/a1193532c181
changeset: 1266:a1193532c181
user: Janus Dam Nielsen <[email protected]>
date: Fri Oct 09 12:21:14 2009 +0200
summary: Made hashbroadcast.py Python 2.4 compliant.
diffstat:
viff/hash_broadcast.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (24 lines):
diff -r 4045c231587a -r a1193532c181 viff/hash_broadcast.py
--- a/viff/hash_broadcast.py Fri Oct 09 11:39:54 2009 +0200
+++ b/viff/hash_broadcast.py Fri Oct 09 12:21:14 2009 +0200
@@ -54,7 +54,7 @@
signals[peer_id] = long(signal)
# If all signals are received then check if they are OK or
INCONSISTENTHASH.
if num_receivers == len(signals.keys()):
- s = reduce(lambda x, y: OK if OK == y else INCONSISTENTHASH,
signals.values())
+ s = reduce(lambda x, y: (OK == y and OK) or INCONSISTENTHASH,
signals.values())
if OK == s:
# Make the result ready.
result.callback(message[0])
@@ -69,7 +69,10 @@
signal = OK
# First we check if the hashes we received are equal to the
hash we computed ourselves.
for peer_id in receivers:
- signal = signal if a_hashes[peer_id] == a_hashes[self.id]
else INCONSISTENTHASH
+ if a_hashes[peer_id] == a_hashes[self.id]:
+ signal = signal
+ else:
+ signal = INCONSISTENTHASH
# Then we send the SAME signal to everybody.
for peer_id in receivers:
self.protocols[peer_id].sendData(unique_pc, SIGNAL,
str(signal))
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk