From 68be61f33402dd7a9b091e98e3f9a7e5c6c55d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Wed, 20 Dec 2023 07:38:37 -0500 Subject: [PATCH] turn_sock: do not cleanup while binding Upstream issue: https://github.com/pjsip/pjproject/issues/3776 This is a workaround, hoping it will be fixed upstream. I don't have a clean fix right now Change-Id: I500cd01c0ee58de5ef1a57bef5ab603a9f9669f6 --- pjnath/src/pjnath/turn_sock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pjnath/src/pjnath/turn_sock.c b/pjnath/src/pjnath/turn_sock.c index b3538d3d7..e7c773735 100644 --- a/pjnath/src/pjnath/turn_sock.c +++ b/pjnath/src/pjnath/turn_sock.c @@ -1587,8 +1587,12 @@ static pj_bool_t dataconn_on_data_read(pj_activesock_t *asock, if (size == 0 && status != PJ_SUCCESS) { /* Connection gone, release data connection */ - dataconn_cleanup(conn); - --turn_sock->data_conn_cnt; + if (conn->state == DATACONN_STATE_CONN_BINDING) { + // TODO cancel request (and do not cleanup there) + } else if (conn->state == DATACONN_STATE_READY) { + dataconn_cleanup(conn); + --turn_sock->data_conn_cnt; + } pj_grp_lock_release(turn_sock->grp_lock); return PJ_FALSE; }