algesten / str0m

A Sans I/O WebRTC implementation in Rust.
MIT License
317 stars 49 forks source link

feat: expose `Candidate::discarded` #497

Closed thomaseizinger closed 1 month ago

thomaseizinger commented 5 months ago

This is useful / necessary to differentiate between active and invalidated candidates when accessing them via IceAgent::local_candidates.

Alternatively, we could also filter them directly there or prune all discarded candidates from the agent?

thomaseizinger commented 5 months ago

Could we filter them instead?

As I see it, Candidate should not have a state. The discarded flag is probably there or convenience, but we don't want it. Especially not in public API.

Yeah definitely. So local_candidates and remote_candidates always filtered by !discarded?

Shall we move them to a different collection perhaps so we can remove the state?

algesten commented 5 months ago

I think because we use usize indexes to the vec holding them, we can't move them out easily. We could make some wrapper Entry type to hold the state and candidate though.

thomaseizinger commented 5 months ago

I think because we use usize indexes to the vec holding them, we can't move them out easily. We could make some wrapper Entry type to hold the state and candidate though.

Hmm, right. Perhaps a slab would help here?