http://hg.viff.dk/viff/rev/a9119cc75e11
changeset: 1164:a9119cc75e11
user: Martin Geisler <[email protected]>
date: Wed Apr 15 00:15:48 2009 +0200
summary: Document the ShareExchanger.sendData method.
diffstat:
1 file changed, 15 insertions(+)
viff/runtime.py | 15 +++++++++++++++
diffs (25 lines):
diff -r 65cce3c355a0 -r a9119cc75e11 viff/runtime.py
--- a/viff/runtime.py Wed Apr 15 00:07:07 2009 +0200
+++ b/viff/runtime.py Wed Apr 15 00:15:48 2009 +0200
@@ -322,6 +322,21 @@
deq.append(data)
def sendData(self, program_counter, data_type, data):
+ """Send data to the peer.
+
+ The *program_counter* is a tuple of unsigned integers, the
+ *data_type* is an unsigned byte and *data* is a string.
+
+ The data is encoded as follows::
+
+ +---------+-----------+-----------+--------+--------------+
+ | pc_size | data_size | data_type | pc | data |
+ +---------+-----------+-----------+--------+--------------+
+ 2 bytes 2 bytes 1 byte varies varies
+
+ The program counter takes up 4 * ``pc_size`` bytes, the data
+ takes up ``data_size`` bytes.
+ """
pc_size = len(program_counter)
data_size = len(data)
fmt = "!HHB%dI%ds" % (pc_size, data_size)
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk