changeset 959:0e067bc07ee3

Avoid sending data to ourselves in Bracha broadcast.
author Martin Geisler <mg@daimi.au.dk>
date Thu, 02 Oct 2008 21:39:51 +0200
parents 0c69f21714b7
children c1f4a7b57e75
files viff/active.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/viff/active.py	Thu Oct 02 21:07:31 2008 +0200
+++ b/viff/active.py	Thu Oct 02 21:39:51 2008 +0200
@@ -113,9 +113,6 @@
         # In the following we prepare to handle a send message from
         # the sender and at most one echo and one ready message from
         # each player.
-        d_send = Deferred().addCallback(send_received)
-        self._expect_data(sender, "send", d_send)
-
         for peer_id in self.players:
             if peer_id != self.id:
                 d_echo = Deferred().addCallback(echo_received, peer_id)
@@ -130,6 +127,10 @@
         if self.id == sender:
             unsafe_broadcast("send", message)
             send_received(message)
+        else:
+            d_send = Deferred().addCallback(send_received)
+            self._expect_data(sender, "send", d_send)
+
 
         return result