Skip to content

net: convenience methods for single typed message on byte stream #49

@robinhundt

Description

@robinhundt

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:

{
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions