Skip to content

Commit

Permalink
clean up ice code
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrtc committed Mar 10, 2024
1 parent 03234e2 commit cf8001f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 80 deletions.
68 changes: 0 additions & 68 deletions rtc-ice/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ impl Agent {

self.update_connection_state(ConnectionState::Checking);
self.request_connectivity_check();
self.connectivity_checks();

Ok(())
}
Expand Down Expand Up @@ -497,73 +496,6 @@ impl Agent {
self.last_connection_state = self.connection_state;
}

fn connectivity_checks(&mut self) {
const ZERO_DURATION: Duration = Duration::from_secs(0);
/*TODO: let mut last_connection_state = ConnectionState::Unspecified;
let mut checking_duration = Instant::now();
let (check_interval, keepalive_interval, disconnected_timeout, failed_timeout) = (
self.check_interval,
self.keepalive_interval,
self.disconnected_timeout,
self.failed_timeout,
);
let done_and_force_candidate_contact_rx = {
let mut done_and_force_candidate_contact_rx =
self.done_and_force_candidate_contact_rx.lock().await;
done_and_force_candidate_contact_rx.take()
};*/

/*TODO:
if let Some((mut done_rx, mut force_candidate_contact_rx)) =
done_and_force_candidate_contact_rx
{
let ai = Arc::clone(self);
tokio::spawn(async move {
loop {
let mut interval = DEFAULT_CHECK_INTERVAL;
let mut update_interval = |x: Duration| {
if x != ZERO_DURATION && (interval == ZERO_DURATION || interval > x) {
interval = x;
}
};
match last_connection_state {
ConnectionState::New | ConnectionState::Checking => {
// While connecting, check candidates more frequently
update_interval(check_interval);
}
ConnectionState::Connected | ConnectionState::Disconnected => {
update_interval(keepalive_interval);
}
_ => {}
};
// Ensure we run our task loop as quickly as the minimum of our various configured timeouts
update_interval(disconnected_timeout);
update_interval(failed_timeout);
let t = tokio::time::sleep(interval);
tokio::pin!(t);
tokio::select! {
_ = t.as_mut() => {
ai.contact(&mut last_connection_state, &mut checking_duration).await;
},
_ = force_candidate_contact_rx.recv() => {
ai.contact(&mut last_connection_state, &mut checking_duration).await;
},
_ = done_rx.recv() => {
return;
}
}
}
});
}
*/
}

pub(crate) fn update_connection_state(&mut self, new_state: ConnectionState) {
if self.connection_state != new_state {
// Connection has gone to failed, release all gathered candidates
Expand Down
4 changes: 0 additions & 4 deletions rtc-ice/src/candidate/candidate_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,4 @@ impl CandidatePair {
+ 2 * u64::from(std::cmp::max(g, d))
+ u64::from(g > d)
}

/*TODO: pub fn write(&mut self, b: &[u8]) -> shared::error::Result<usize> {
self.local.write_to(b, &*self.remote)
}*/
}
2 changes: 0 additions & 2 deletions rtc-ice/src/candidate/candidate_relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub struct CandidateRelayConfig {

pub rel_addr: String,
pub rel_port: u16,
//TODO:pub relay_client: Option<Arc<turn::client::Client>>,
}

impl CandidateRelayConfig {
Expand Down Expand Up @@ -41,7 +40,6 @@ impl CandidateRelayConfig {
address: self.rel_addr,
port: self.rel_port,
}),
//TODO: relay_client: self.relay_client.clone(),
..Candidate::default()
})
}
Expand Down
6 changes: 0 additions & 6 deletions rtc-ice/src/candidate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ pub struct CandidateConfig {
pub component: u16,
pub priority: u32,
pub foundation: String,
//todo: pub initialized_ch: Option<broadcast::Receiver<()>>,
}

pub struct Candidate {
Expand All @@ -148,14 +147,10 @@ pub struct Candidate {
pub(crate) last_sent: Instant,
pub(crate) last_received: Instant,

//todo: pub(crate) closed_ch: Arc<Mutex<Option<broadcast::Sender<()>>>>,
pub(crate) foundation_override: String,
pub(crate) priority_override: u32,

//CandidateHost
pub(crate) network: String,
//CandidateRelay
//TODO: pub(crate) relay_client: Option<Arc<turn::client::Client>>,
}

impl Default for Candidate {
Expand All @@ -179,7 +174,6 @@ impl Default for Candidate {
foundation_override: String::new(),
priority_override: 0,
network: String::new(),
//TODO: relay_client: None,
}
}
}
Expand Down

0 comments on commit cf8001f

Please sign in to comment.