Commit 188a7e44 authored by Pekka Pessi's avatar Pekka Pessi

nua_client, nua_session: avoid restarting in-progress transactions

Ignore-this: c8b01b7b280aa7d4c2ddde4a9d247b94

This is supposed to fix bugs #SFSIP-135 and #SFSIP-137. Thanks for Tamas
Jalsovszky and kawarod for reporting the problem.

darcs-hash:20090416170408-db55f-ccd6db09aea9f67353a93df6ab23292bb768863e.gz
parent f489a6e8
......@@ -413,6 +413,20 @@ int nua_client_bind(nua_client_request_t *cr, nua_dialog_usage_t *du)
return 0;
}
/** Check if client request is in progress.
*
* A client request is in progress, if
* 1) it has actual transaction going on
* 2) it is waiting credentials from application
* 3) it is waiting for Retry-After timer
*/
int
nua_client_request_in_progress(nua_client_request_t const *cr)
{
return cr &&
(cr->cr_orq || cr->cr_wait_for_cred || cr->cr_timer);
}
/**Initialize client request for sending.
*
* This function is called when the request is taken from queue and sent.
......@@ -1562,7 +1576,7 @@ int nua_client_next_request(nua_client_request_t *cr, int invite)
break;
}
if (cr && cr->cr_orq == NULL) {
if (cr && !nua_client_request_in_progress(cr)) {
nua_client_init_request(cr);
}
......
......@@ -250,6 +250,8 @@ su_inline int nua_client_is_queued(nua_client_request_t const *cr)
return cr && cr->cr_prev;
}
int nua_client_request_in_progress(nua_client_request_t const *cr);
int nua_client_request_complete(nua_client_request_t *cr);
int nua_client_request_remove(nua_client_request_t *cr);
int nua_client_request_clean(nua_client_request_t *cr);
......
......@@ -1535,7 +1535,7 @@ static void nua_session_usage_refresh(nua_handle_t *nh,
if (ss->ss_state >= nua_callstate_terminating ||
/* INVITE is in progress or being authenticated */
(cr && (cr->cr_orq || cr->cr_wait_for_cred)))
nua_client_request_in_progress(cr))
return;
/* UPDATE has been queued */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment