From 04acab5a3214a0d45fccf3d5d33e30d37729a348 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Tue, 7 Apr 2020 10:28:57 -0400
Subject: [PATCH] pjproject: avoid to cancel succesful connection

The timer is triggered through a passive candidate, so it should
be done only if the timer is none.

Change-Id: I89a16467667393949ad38b4184b4edfb0a452675
---
 contrib/src/pjproject/0001-rfc6544.patch | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/src/pjproject/0001-rfc6544.patch b/contrib/src/pjproject/0001-rfc6544.patch
index 1ea813368f..370b3831ad 100644
--- a/contrib/src/pjproject/0001-rfc6544.patch
+++ b/contrib/src/pjproject/0001-rfc6544.patch
@@ -669,7 +669,7 @@ index fff4fad26..e7f8b84eb 100644
      if (status != PJ_SUCCESS && status != PJ_EPENDING) {
  	app_perror("    error: server sending data", status);
 diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c
-index 2a4125bc5..526c8e13f 100644
+index 2a4125bc5..d2eae9494 100644
 --- a/pjnath/src/pjnath/ice_session.c
 +++ b/pjnath/src/pjnath/ice_session.c
 @@ -18,6 +18,7 @@
@@ -966,10 +966,10 @@ index 2a4125bc5..526c8e13f 100644
 +    case PJ_CAND_TCP_SO:
 +    default:
 +        if (lcand->type == PJ_ICE_CAND_TYPE_RELAYED) {
-+            pj_timer_heap_cancel_if_active(ice->stun_cfg.timer_heap,
-+                                           &ice->timer, TIMER_NONE);
 +            status = (*ice->cb.select_turn_dataconn)(ice, clist, check_id);
 +            if (ice->timer.id == TIMER_NONE) {
++				pj_timer_heap_cancel_if_active(ice->stun_cfg.timer_heap,
++											&ice->timer, TIMER_NONE);
 +                pj_time_val delay = {
 +                    .sec  = 0,
 +                    .msec = 1500
@@ -4127,4 +4127,4 @@ index 474a8d07c..9257f07a4 100644
 +				     sess->af, PJ_STUN_TP_UDP, &stun_sock_cb,
  				     NULL, sess, &sess->stun_sock);
  	if (status != PJ_SUCCESS) {
- 	    char errmsg[PJ_ERR_MSG_SIZE];
\ No newline at end of file
+ 	    char errmsg[PJ_ERR_MSG_SIZE];
-- 
GitLab