-
Notifications
You must be signed in to change notification settings - Fork 1
Description
There are several places in the OT implementations where one byte stream is created and then several differently typed and serialized messages are sent over this single stream, e.g. like this:
CryProt/cryprot-ot/src/base.rs
Lines 76 to 79 in bee0b02
| { | |
| let mut send_m1 = send.as_stream(); | |
| send_m1.send((A, *seed_commitment.as_bytes())).await?; | |
| } |
This avoids the small overhead of creating multiple typed sub-streams. It works, as there is only ever one kind of message in-flight in these circumstances. A drawback could be, that this API could easily lead to bugs when there is no enforced ordering of the messages.
We could add convenience methods on the byte stream to send/receive a single typed message.
Or alternatively, we could look at session types for these simple communication patterns, but that is a much larger task.