Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ICE] How to restart the ICE agent? #554

Open
JustusvonderBeek opened this issue Apr 14, 2024 · 0 comments
Open

[ICE] How to restart the ICE agent? #554

JustusvonderBeek opened this issue Apr 14, 2024 · 0 comments

Comments

@JustusvonderBeek
Copy link

JustusvonderBeek commented Apr 14, 2024

I'm trying to use the restart functionality of the ICE agent, however I cannot get this function to work. When I'm trying to call dial/accept a second time a ErrMultipleStart error is thrown. I'm not sure if this is due to an error on my side or some other problem. Maybe you can guide me into the right direction of calls to make?

To reproduce (simplified client side, server side replaces the dial with accept()):

let agent = Agent::new(
    network_types: vec![NetworkType::Udp4],
    udp_network,
    ..Default::default()
);
agent.on_candidate(Box::new(move |c| {
    // sending the ICE candidate to the other side...
}));
agent.gather_candidates().unwrap();
match agent.dial(cancel_rx, remote_ufrag.clone(). remote_pwd.clone()).await {
    Ok(_) => {},
    Err(e) => {
        error!("Failed to connect to remote: {}", e);
    },
};
agent.restart(local_ufrag.clone(), local_pwd.clone()).await.unwrap();
agent.gather_candidates().unwrap();
match agent.dial(cancel_rx, remote_ufrag.clone(). remote_pwd.clone()).await {
    Ok(_) => {},
    Err(e) => {
        error!("Failed to connect to remote: {}", e); // <- Fails with **ErrMultipleStart**, 
        //due to the self.started_ch_tx: Sender() channel being taken in the
        // call to start_connectivity_check inside of AgentInternal
    },
};

When calling the dial/accept a second time the ErrMultipleStart mentioned above is returned. I tracked the issue down to the: self.started_ch_tx: Sender() which is being taken (take()) in the call to start_connectivity_checks inside of the AgentInternal and never reassigned.

Is this use-case of repeatedly searching for new paths currently supported in the ICE implementation? Or am I supposed to create a new ICE agent to search again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant