Commit f0d45026 authored by Pekka Pessi's avatar Pekka Pessi

Updated dialog usage refreshes.

Updated nua_dialog_usage_refresh(), nh_call_pending().

darcs-hash:20060510070357-65a35-8ae1d0a6149d2368e6f7f79cf5e9e5fe155a9d60.gz
parent 9d513676
......@@ -445,7 +445,24 @@ void nua_dialog_usage_refresh(nua_owner_t *owner,
if (du) {
nh_pending_f *pending = du->du_pending;
du->du_refresh = 0;
if (now > 0) {
if (du->du_class->usage_refresh) {
du->du_class->usage_refresh(owner, du, now);
return;
}
}
else {
du->du_shutdown = 1;
if (du->du_class->usage_shutdown) {
du->du_class->usage_shutdown(owner, du);
return;
}
}
du->du_pending = NULL;
if (pending)
pending(owner, du, now);
}
......
......@@ -98,6 +98,8 @@ typedef struct {
void (*usage_peer_info)(nua_dialog_usage_t *du,
nua_dialog_state_t const *ds,
sip_t const *sip);
void (*usage_refresh)(nua_owner_t *, nua_dialog_usage_t *, sip_time_t now);
int (*usage_shutdown)(nua_owner_t *, nua_dialog_usage_t *);
} nua_usage_class;
struct nua_dialog_usage {
......@@ -106,6 +108,7 @@ struct nua_dialog_usage {
unsigned du_terminating:1; /**< Now trying to terminate usage */
unsigned du_ready:1; /**< Established usage */
unsigned du_shutdown:1; /**< Shutdown in progress */
unsigned:0;
/** Pending operation.
......
......@@ -485,8 +485,6 @@ int nh_call_pending(nua_handle_t *nh, sip_time_t now)
for (du = nh->nh_ds->ds_usage; du; du = du->du_next) {
if (now == 0)
break;
if (!du->du_pending)
continue;
if (du->du_refresh && du->du_refresh < next)
break;
}
......@@ -497,15 +495,9 @@ int nh_call_pending(nua_handle_t *nh, sip_time_t now)
nua_handle_ref(nh);
while (du) {
nh_pending_f *pending = du->du_pending;
nua_dialog_usage_t *du_next = du->du_next;
du->du_pending = NULL;
if (pending)
pending(nh, du, now);
else
nua_dialog_usage_remove(nh, nh->nh_ds, du);
nua_dialog_usage_refresh(nh, du, now);
if (du_next == NULL)
break;
......@@ -517,8 +509,6 @@ int nh_call_pending(nua_handle_t *nh, sip_time_t now)
for (; du; du = du->du_next) {
if (now == 0)
break;
if (!du->du_pending)
continue;
if (du->du_refresh && du->du_refresh < next)
break;
}
......
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