Skip to content

Stream::connect() never fails nor times out #88

@andrewdavidmackenzie

Description

@andrewdavidmackenzie

Is your feature request related to a problem?
When I call Stream::connect() to connect to a known BLE device, if it is powered down, or absent, or connected to another computer/mobile, the attempt to connect never fails nor times out and my app is blocked waiting to connect

    let ble_stream = utils::stream::build_ble_stream::<BleId>(
        BleId::from_mac_address(&mac_address.to_string()).unwrap(),
        Duration::from_secs(4),
    )
    .await?;
    let stream_api = StreamApi::new();
    let (packet_receiver, stream_api) = stream_api.connect(ble_stream).await;

Describe the solution you’d like
A configurable timeout period on the connect method, which returns Result, and a specific error returned to show the connection attempt timed out.

If you do not wish to modify signatures, then adding a try_connect() methods that can timeout would be fine.

Additional context
Any other relevant info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions