viff

changeset 596:4a1f03f138ba

Made _expect_data more strict, fixed Bracha broadcast.
author Martin Geisler <mg@daimi.au.dk>
date Sat, 22 Mar 2008 15:53:25 +0100
parents 3630428d6a51
children 5845aca82a6e
files viff/runtime.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Sat Mar 22 15:25:20 2008 +0100
     1.2 +++ b/viff/runtime.py	Sat Mar 22 15:53:25 2008 +0100
     1.3 @@ -550,6 +550,7 @@
     1.4          return result
     1.5  
     1.6      def _expect_data(self, peer_id, type, deferred):
     1.7 +        assert peer_id != self.id, "Do not expect data from yourself!"
     1.8          # Convert self.program_counter to a hashable value in order
     1.9          # to use it as a key in self.incoming_data.
    1.10          pc = tuple(self.program_counter)
    1.11 @@ -989,11 +990,12 @@
    1.12          self._expect_data(sender, "send", d_send)
    1.13  
    1.14          for peer_id in self.players:
    1.15 -            d_echo = Deferred().addCallback(echo_received, peer_id)
    1.16 -            self._expect_data(peer_id, "echo", d_echo)
    1.17 +            if peer_id != self.id:
    1.18 +                d_echo = Deferred().addCallback(echo_received, peer_id)
    1.19 +                self._expect_data(peer_id, "echo", d_echo)
    1.20  
    1.21 -            d_ready = Deferred().addCallback(ready_received, peer_id)
    1.22 -            self._expect_data(peer_id, "ready", d_ready)
    1.23 +                d_ready = Deferred().addCallback(ready_received, peer_id)
    1.24 +                self._expect_data(peer_id, "ready", d_ready)
    1.25  
    1.26          # If this player is the sender, we transmit a send message to
    1.27          # each player. We send one to this player by calling the