From 9951b647ab19443f095300fd37ee32edbd819f1c Mon Sep 17 00:00:00 2001 From: topworldcoder <63830798+topworldcoder@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:44:56 +0800 Subject: [PATCH] add agent_connectivity_reset while at CONTROLLED mode add agent_connectivity_reset while at CONTROLLED mode --- src/agent.c | 6 ++++++ src/agent.h | 2 ++ src/peer_connection.c | 1 + 3 files changed, 9 insertions(+) diff --git a/src/agent.c b/src/agent.c index 525301f..729ef1b 100644 --- a/src/agent.c +++ b/src/agent.c @@ -469,6 +469,12 @@ int agent_connectivity_check(Agent* agent) { return -1; } +void agent_connectivity_reset(Agent* agent) { + for (int i = 0; i < agent->candidate_pairs_num; i++) { + agent->candidate_pairs[i].state = ICE_CANDIDATE_STATE_FROZEN; + } +} + int agent_select_candidate_pair(Agent* agent) { int i; for (i = 0; i < agent->candidate_pairs_num; i++) { diff --git a/src/agent.h b/src/agent.h index 86da0e5..0babb47 100644 --- a/src/agent.h +++ b/src/agent.h @@ -82,6 +82,8 @@ int agent_recv(Agent* agent, uint8_t* buf, int len); void agent_set_remote_description(Agent* agent, char* description); +void agent_connectivity_reset(Agent* agent); + int agent_select_candidate_pair(Agent* agent); int agent_connectivity_check(Agent* agent); diff --git a/src/peer_connection.c b/src/peer_connection.c index 49f4569..470e1a8 100644 --- a/src/peer_connection.c +++ b/src/peer_connection.c @@ -467,6 +467,7 @@ int peer_connection_loop(PeerConnection* pc) { } if (KEEPALIVE_CONNCHECK > 0 && (ports_get_epoch_time() - pc->agent.binding_request_time) > KEEPALIVE_CONNCHECK) { + agent_connectivity_reset(&pc->agent); LOGI("binding request timeout"); STATE_CHANGED(pc, PEER_CONNECTION_CLOSED); }