Skip to content
Snippets Groups Projects
Commit c2574544 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

pjproject: remove status_send_msg causing confusion and errors

In 4463ed9e a condition was replaced
with the bad status causing wrong behaviors. Just use one status
variable to avoid confusion and avoid future errors.

Change-Id: I950befbfdd966d9dbfb9710d0427ae296dfabcb3
parent c6142d8b
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ on behalf of Savoir-faire Linux. ...@@ -29,7 +29,7 @@ on behalf of Savoir-faire Linux.
pjnath/src/pjnath-test/concur_test.c | 5 +- pjnath/src/pjnath-test/concur_test.c | 5 +-
pjnath/src/pjnath-test/sess_auth.c | 14 +- pjnath/src/pjnath-test/sess_auth.c | 14 +-
pjnath/src/pjnath-test/stun_sock_test.c | 7 +- pjnath/src/pjnath-test/stun_sock_test.c | 7 +-
pjnath/src/pjnath/ice_session.c | 597 +++++++++++-- pjnath/src/pjnath/ice_session.c | 596 +++++++++++--
pjnath/src/pjnath/ice_strans.c | 747 +++++++++++++--- pjnath/src/pjnath/ice_strans.c | 747 +++++++++++++---
pjnath/src/pjnath/nat_detect.c | 7 +- pjnath/src/pjnath/nat_detect.c | 7 +-
pjnath/src/pjnath/stun_session.c | 19 +- pjnath/src/pjnath/stun_session.c | 19 +-
...@@ -42,7 +42,7 @@ on behalf of Savoir-faire Linux. ...@@ -42,7 +42,7 @@ on behalf of Savoir-faire Linux.
pjnath/src/pjturn-srv/server.c | 2 +- pjnath/src/pjturn-srv/server.c | 2 +-
pjsip-apps/src/samples/icedemo.c | 116 ++- pjsip-apps/src/samples/icedemo.c | 116 ++-
pjsip/src/pjsua-lib/pjsua_core.c | 2 +- pjsip/src/pjsua-lib/pjsua_core.c | 2 +-
22 files changed, 2549 insertions(+), 424 deletions(-) 22 files changed, 2548 insertions(+), 424 deletions(-)
diff --git a/pjnath/include/pjnath/config.h b/pjnath/include/pjnath/config.h diff --git a/pjnath/include/pjnath/config.h b/pjnath/include/pjnath/config.h
index fc1e27550..9b44c2645 100644 index fc1e27550..9b44c2645 100644
...@@ -683,7 +683,7 @@ index fff4fad26..e7f8b84eb 100644 ...@@ -683,7 +683,7 @@ index fff4fad26..e7f8b84eb 100644
if (status != PJ_SUCCESS && status != PJ_EPENDING) { if (status != PJ_SUCCESS && status != PJ_EPENDING) {
app_perror(" error: server sending data", status); app_perror(" error: server sending data", status);
diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c
index 2a4125bc5..b50a3d229 100644 index 2a4125bc5..f27c2bab3 100644
--- a/pjnath/src/pjnath/ice_session.c --- a/pjnath/src/pjnath/ice_session.c
+++ b/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
...@@ -1289,7 +1289,7 @@ index 2a4125bc5..b50a3d229 100644 ...@@ -1289,7 +1289,7 @@ index 2a4125bc5..b50a3d229 100644
} }
pj_grp_lock_release(ice->grp_lock); pj_grp_lock_release(ice->grp_lock);
@@ -2181,6 +2449,205 @@ static pj_status_t on_stun_send_msg(pj_stun_session *sess, @@ -2181,6 +2449,204 @@ static pj_status_t on_stun_send_msg(pj_stun_session *sess,
return status; return status;
} }
...@@ -1390,12 +1390,11 @@ index 2a4125bc5..b50a3d229 100644 ...@@ -1390,12 +1390,11 @@ index 2a4125bc5..b50a3d229 100644
+ msg_data->data.req.ckid = current_check; + msg_data->data.req.ckid = current_check;
+ +
+ pj_ice_sess_comp *comp = find_comp(ice, lcand->comp_id); + pj_ice_sess_comp *comp = find_comp(ice, lcand->comp_id);
+ pj_status_t status_send_msg;
+ // Note that USERNAME and MESSAGE-INTEGRITY will be added by the + // Note that USERNAME and MESSAGE-INTEGRITY will be added by the
+ // STUN session. + // STUN session.
+ +
+ // Initiate STUN transaction to send the request + // Initiate STUN transaction to send the request
+ status_send_msg = pj_stun_session_send_msg(comp->stun_sess, msg_data, + status = pj_stun_session_send_msg(comp->stun_sess, msg_data,
+ PJ_FALSE, PJ_FALSE, &rcand->addr, + PJ_FALSE, PJ_FALSE, &rcand->addr,
+ pj_sockaddr_get_len(&rcand->addr), + pj_sockaddr_get_len(&rcand->addr),
+ check->tdata); + check->tdata);
...@@ -1415,11 +1414,11 @@ index 2a4125bc5..b50a3d229 100644 ...@@ -1415,11 +1414,11 @@ index 2a4125bc5..b50a3d229 100644
+ * reached its timeout. + * reached its timeout.
+ */ + */
+ check_set_state(ice, check,PJ_ICE_SESS_CHECK_STATE_NEEDS_RETRY, + check_set_state(ice, check,PJ_ICE_SESS_CHECK_STATE_NEEDS_RETRY,
+ status_send_msg); + status);
+ } else if (status_send_msg == PJ_EBUSY /* EBUSY */) { + } else if (status == PJ_EBUSY /* EBUSY */) {
+ check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_NEEDS_FIRST_PACKET, + check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_NEEDS_FIRST_PACKET,
+ status_send_msg); + status);
+ } else if (status_send_msg != PJ_SUCCESS) { + } else if (status != PJ_SUCCESS) {
+ +
+ if (rcand->type == PJ_ICE_CAND_TYPE_RELAYED) { + if (rcand->type == PJ_ICE_CAND_TYPE_RELAYED) {
+ char raddr[PJ_INET6_ADDRSTRLEN + 10]; + char raddr[PJ_INET6_ADDRSTRLEN + 10];
...@@ -1428,7 +1427,7 @@ index 2a4125bc5..b50a3d229 100644 ...@@ -1428,7 +1427,7 @@ index 2a4125bc5..b50a3d229 100644
+ pj_sockaddr_print(&rcand->addr, raddr, sizeof(raddr), 3), status)); + pj_sockaddr_print(&rcand->addr, raddr, sizeof(raddr), 3), status));
+ } + }
+ check->tdata = NULL; + check->tdata = NULL;
+ pjnath_perror(ice->obj_name, "Error sending STUN request (on peer connection)", status_send_msg); + pjnath_perror(ice->obj_name, "Error sending STUN request (on peer connection)", status);
+ pj_log_pop_indent(); + pj_log_pop_indent();
+ check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_FAILED, status); + check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_FAILED, status);
+ on_check_complete(ice, check); + on_check_complete(ice, check);
...@@ -1495,7 +1494,7 @@ index 2a4125bc5..b50a3d229 100644 ...@@ -1495,7 +1494,7 @@ index 2a4125bc5..b50a3d229 100644
/* This callback is called when outgoing STUN request completed */ /* This callback is called when outgoing STUN request completed */
static void on_stun_request_complete(pj_stun_session *stun_sess, static void on_stun_request_complete(pj_stun_session *stun_sess,
@@ -2411,7 +2878,9 @@ static void on_stun_request_complete(pj_stun_session *stun_sess, @@ -2411,7 +2877,9 @@ static void on_stun_request_complete(pj_stun_session *stun_sess,
&check->lcand->base_addr, &check->lcand->base_addr,
&check->lcand->base_addr, &check->lcand->base_addr,
pj_sockaddr_get_len(&xaddr->sockaddr), pj_sockaddr_get_len(&xaddr->sockaddr),
...@@ -1506,7 +1505,7 @@ index 2a4125bc5..b50a3d229 100644 ...@@ -1506,7 +1505,7 @@ index 2a4125bc5..b50a3d229 100644
if (status != PJ_SUCCESS) { if (status != PJ_SUCCESS) {
check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_FAILED, check_set_state(ice, check, PJ_ICE_SESS_CHECK_STATE_FAILED,
status); status);
@@ -2474,11 +2943,7 @@ static void on_stun_request_complete(pj_stun_session *stun_sess, @@ -2474,11 +2942,7 @@ static void on_stun_request_complete(pj_stun_session *stun_sess,
/* Perform 7.1.2.2.2. Updating Pair States. /* Perform 7.1.2.2.2. Updating Pair States.
* This may terminate ICE processing. * This may terminate ICE processing.
*/ */
...@@ -1519,7 +1518,7 @@ index 2a4125bc5..b50a3d229 100644 ...@@ -1519,7 +1518,7 @@ index 2a4125bc5..b50a3d229 100644
pj_grp_lock_release(ice->grp_lock); pj_grp_lock_release(ice->grp_lock);
} }
@@ -2673,9 +3138,13 @@ static pj_status_t on_stun_rx_request(pj_stun_session *sess, @@ -2673,9 +3137,13 @@ static pj_status_t on_stun_rx_request(pj_stun_session *sess,
msg_data->has_req_data = PJ_FALSE; msg_data->has_req_data = PJ_FALSE;
/* Send the response */ /* Send the response */
...@@ -1535,7 +1534,7 @@ index 2a4125bc5..b50a3d229 100644 ...@@ -1535,7 +1534,7 @@ index 2a4125bc5..b50a3d229 100644
/* /*
* Handling early check. * Handling early check.
@@ -2794,12 +3263,12 @@ static void handle_incoming_check(pj_ice_sess *ice, @@ -2794,12 +3262,12 @@ static void handle_incoming_check(pj_ice_sess *ice,
/* Just get candidate with the highest priority and same transport ID /* Just get candidate with the highest priority and same transport ID
* for the specified component ID in the checklist. * for the specified component ID in the checklist.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment