Commit 2c770922 authored by Simon Morlat's avatar Simon Morlat
Browse files

protect osip_list_set_empty()

fix spurious "no response" errors at end of calls
parent 2e35f52d
......@@ -30,9 +30,10 @@ static void text_received(Sal *sal, eXosip_event_t *ev);
void _osip_list_set_empty(osip_list_t *l, void (*freefunc)(void*)){
void *data;
while((data=osip_list_get(l,0))!=NULL){
while(!osip_list_eol(l,0)) {
data=osip_list_get(l,0);
osip_list_remove(l,0);
freefunc(data);
if (data) freefunc(data);
}
}
......@@ -168,6 +169,7 @@ SalOp * sal_op_new(Sal *sal){
op->masquerade_via=FALSE;
op->auto_answer_asked=FALSE;
op->auth_info=NULL;
op->terminated=FALSE;
return op;
}
......@@ -778,6 +780,7 @@ int sal_call_terminate(SalOp *h){
if (err!=0){
ms_warning("Exosip could not terminate the call: cid=%i did=%i", h->cid,h->did);
}
h->terminated=TRUE;
return 0;
}
......@@ -1004,6 +1007,7 @@ static int call_proceeding(Sal *sal, eXosip_event_t *ev){
eXosip_lock();
eXosip_call_terminate(ev->cid,ev->did);
eXosip_unlock();
op->terminated=TRUE;
return -1;
}
if (ev->did>0)
......@@ -1080,6 +1084,7 @@ static void call_terminated(Sal *sal, eXosip_event_t *ev){
}
sal->callbacks.call_terminated(op,from!=NULL ? from : sal_op_get_from(op));
if (from) osip_free(from);
op->terminated=TRUE;
}
static void call_released(Sal *sal, eXosip_event_t *ev){
......@@ -1088,7 +1093,7 @@ static void call_released(Sal *sal, eXosip_event_t *ev){
ms_warning("No op associated to this call_released()");
return;
}
if (ev->response==NULL){
if (!op->terminated){
/* no response received so far */
call_failure(sal,ev);
}
......@@ -1871,8 +1876,14 @@ int sal_register(SalOp *h, const char *proxy, const char *from, int expires){
if (h->rid==-1){
eXosip_lock();
h->rid=eXosip_register_build_initial_register(from,proxy,NULL,expires,&msg);
if (contact) register_set_contact(msg,contact);
sal_add_register(h->base.root,h);
if (msg){
if (contact) register_set_contact(msg,contact);
sal_add_register(h->base.root,h);
}else{
ms_error("Could not build initial register.");
eXosip_unlock();
return -1;
}
}else{
eXosip_lock();
eXosip_register_build_register(h->rid,expires,&msg);
......
......@@ -65,6 +65,7 @@ struct SalOp{
bool_t reinvite;
bool_t masquerade_via;
bool_t auto_answer_asked;
bool_t terminated;
const SalAuthInfo *auth_info;
};
......
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