fix_turn_fallback.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --- a/pjnath/src/pjnath/turn_session.c 2016-09-19 18:21:09.073614574 -0400
  2. +++ b/pjnath/src/pjnath/turn_session.c 2016-09-19 18:21:30.648631620 -0400
  3. @@ -653,3 +653,3 @@
  4. - cnt = PJ_TURN_MAX_DNS_SRV_CNT;
  5. + cnt = 1;
  6. ai = (pj_addrinfo*)
  7. --- a/pjnath/src/pjnath/ice_strans.c 2016-09-19 18:36:04.180104330 -0400
  8. +++ b/pjnath/src/pjnath/ice_strans.c 2016-09-19 18:37:10.614136809 -0400
  9. @@ -1304,2 +1304,5 @@
  10. + if (!comp->turn[n].sock)
  11. + continue;
  12. +
  13. /* Gather remote addresses for this component */
  14. @@ -1995,4 +1998,37 @@
  15. sess_init_update(comp->ice_st);
  16. + } else if ((old_state == PJ_TURN_STATE_RESOLVING || old_state == PJ_TURN_STATE_ALLOCATING) &&
  17. + new_state >= PJ_TURN_STATE_DEALLOCATING)
  18. + {
  19. + pj_ice_sess_cand *cand = NULL;
  20. + unsigned i;
  21. +
  22. + /* DNS resolution has failed! */
  23. + ++comp->turn[tp_idx].err_cnt;
  24. +
  25. + /* Unregister ourself from the TURN relay */
  26. + pj_turn_sock_set_user_data(turn_sock, NULL);
  27. + comp->turn[tp_idx].sock = NULL;
  28. +
  29. + /* Wait until initialization completes */
  30. + pj_grp_lock_acquire(comp->ice_st->grp_lock);
  31. +
  32. + /* Find relayed candidate in the component */
  33. + for (i=0; i<comp->cand_cnt; ++i) {
  34. + if (comp->cand_list[i].type == PJ_ICE_CAND_TYPE_RELAYED &&
  35. + comp->cand_list[i].transport_id == data->transport_id)
  36. + {
  37. + cand = &comp->cand_list[i];
  38. + break;
  39. + }
  40. + }
  41. + pj_assert(cand != NULL);
  42. +
  43. + pj_grp_lock_release(comp->ice_st->grp_lock);
  44. +
  45. + cand->status = old_state == PJ_TURN_STATE_RESOLVING ? PJ_ERESOLVE : PJ_EINVALIDOP;
  46. +
  47. + sess_init_update(comp->ice_st);
  48. +
  49. } else if (new_state >= PJ_TURN_STATE_DEALLOCATING) {
  50. pj_turn_session_info info;