viff

changeset 1161:8c7d9f684b56

Remove references to the marshal module.
author Martin Geisler <mg@cs.au.dk>
date Tue, 14 Apr 2009 23:20:08 +0200
parents d5741e841ccc
children 83282f6e20b9
files viff/runtime.py
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Tue Apr 14 23:07:13 2009 +0200
     1.2 +++ b/viff/runtime.py	Tue Apr 14 23:20:08 2009 +0200
     1.3 @@ -263,9 +263,6 @@
     1.4      All players are connected by pair-wise connections and this
     1.5      Twisted protocol is one such connection. It is used to send and
     1.6      receive shares from one other player.
     1.7 -
     1.8 -    The :mod:`marshal` module is used for converting the data to bytes
     1.9 -    for the network and to convert back again to structured data.
    1.10      """
    1.11  
    1.12      def __init__(self):
    1.13 @@ -284,9 +281,9 @@
    1.14      def stringReceived(self, string):
    1.15          """Called when a share is received.
    1.16  
    1.17 -        The string received is unmarshalled into the program counter,
    1.18 -        and a data part. The data is passed the appropriate Deferred
    1.19 -        in :class:`self.incoming_data`.
    1.20 +        The string received is unpacked into the program counter, and
    1.21 +        a data part. The data is passed the appropriate Deferred in
    1.22 +        :class:`self.incoming_data`.
    1.23          """
    1.24          if self.peer_id is None:
    1.25              # TODO: Handle ValueError if the string cannot be decoded.
    1.26 @@ -328,9 +325,6 @@
    1.27              else:
    1.28                  deq.append(data)
    1.29  
    1.30 -            # TODO: marshal.loads can raise EOFError, ValueError, and
    1.31 -            # TypeError. They should be handled somehow.
    1.32 -
    1.33      def sendData(self, program_counter, data_type, data):
    1.34          pc_size = len(program_counter)
    1.35          fmt = "%s%is" % ((pc_size + 1)*'i', len(data))
    1.36 @@ -341,8 +335,8 @@
    1.37      def sendShare(self, program_counter, share):
    1.38          """Send a share.
    1.39  
    1.40 -        The program counter and the share are marshalled and sent to
    1.41 -        the peer.
    1.42 +        The program counter and the share are converted to bytes and
    1.43 +        sent to the peer.
    1.44          """
    1.45          self.sendData(program_counter, SHARE, hex(share.value))
    1.46