Skip to content

Commit

Permalink
add agent_connectivity_reset while at CONTROLLED mode
Browse files Browse the repository at this point in the history
add agent_connectivity_reset while at CONTROLLED mode
  • Loading branch information
topworldcoder committed Nov 19, 2024
1 parent 68cdc65 commit 9951b64
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 2 additions & 0 deletions src/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/peer_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 9951b64

Please sign in to comment.