amazon-kinesis-video-streams-webrtc-sdk-c icon indicating copy to clipboard operation
amazon-kinesis-video-streams-webrtc-sdk-c copied to clipboard

fix prflx update interrupted connectivity check

Open vc60er opened this issue 1 year ago • 0 comments

Issue #, if available:

  1. when the two endpiont of connecion both are relay candidate, and the ip of local relay candidate is not the same as remote relay candidate. then can cause local relay candidate update to prflx,and interrupted connectivity check

for example

a ---binding req------------> relayA(ipA) --> realyB(ipB) --------------------------> b
a <--binding resp(xor=ipB)--- relayA(ipA) <-- realyB(ipB) <--binding resp(xor=ipB)--- b

The process is as follows:

  • a have a relay candidate which ip is ipA, b have a relay candidate which ip is ipB, they are paired
  • a send a binding request to b, then b find the request coming from ipB, and send binding response(xor=ipB) to a
  • a receive binding response, and check ipA != ipB, then update local.candidate.addr=ipB, local.candidate.type=prflx,
  • then the code jump to CleanUp, did not continue to update pIceCandidatePair->state to ICE_CANDIDATE_PAIR_STATE_SUCCEEDED, so that the connection can not be established
  1. When the LAN has two external network exits ip, then can cause interrupted connectivity check

for example:

  ---NAT(ip1)--> stun               
  <-------------                    
a ---NAT(ip2)----binding req-----------------------> b
  <--------------binding resp(xor=ip2)--------------

The process is as follows:

  • a have a srflx candiate which ip is ip1, and b have srflx whic ip is ipx, they are paired
  • a send binding request to b, and b finds the request coming from ip2, then send bind response(xor=ip2) to a
  • a receive binding response, and check ip1 != ip2, then update local.candidate.addr=ip2, local.candidate.type=prflx
  • then the code jump to CleanUp, did not continue to update pIceCandidatePair->state to ICE_CANDIDATE_PAIR_STATE_SUCCEEDED, so that the connection can not be established

Description of changes:

  1. Do not interrupt connectivity checks when updating local candidate type to prflx
  2. Only when both local.candiate.type and remote.candidate.type are srflx, then can allowed to update local.candiate.type to prflx when appropriate

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

vc60er avatar Aug 22 '22 16:08 vc60er