Skip to content

No way to detect "EOF" on transport #223

Description

@nikomatsakis

Problem: there is no "event" to indicate that the input event stream has closed. So a naive "proxy' pattern like:

let (tx, rx) = channel();

Builder::new()
    .on_receive_dispatch(... /* send incoming event to proxy */ ...)
    .connect_with(async |cx| {
        /* receive outgoing event to proxy */
        while let Some(m) = rx.recv().await { cx.send(msg); }
    })
    .await;

will hang forever, because the loop in connect_with never completes. I often create loops like this where the tx endpoint is given to some central dispatcher.

I'm debating the best fix here and I'm not entirely sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions