]> sjero.net Git - linphone/commitdiff
fix bug causing double subscribe.
authorSimon Morlat <simon.morlat@linphone.org>
Tue, 16 Mar 2010 15:28:14 +0000 (16:28 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Tue, 16 Mar 2010 15:28:14 +0000 (16:28 +0100)
coreapi/friend.c
coreapi/sal_eXosip2.c
coreapi/sal_eXosip2_presence.c

index 047749e322d02ef35f136fcba5070131dabc8d69..d5377952d3c2780f67970c5c6833343fbb32e9e8 100644 (file)
@@ -152,6 +152,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
        fr->outsub=sal_op_new(fr->lc->sal);
        sal_op_set_route(fr->outsub,route);
        sal_subscribe_presence(fr->outsub,from,friend);
+       fr->subscribe_active=TRUE;
        ms_free(friend);
 }
 
@@ -364,7 +365,7 @@ void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc){
                fr->inc_subscribe_pending=FALSE;
        }
        if (fr->subscribe && fr->subscribe_active==FALSE){
-               
+               ms_message("Sending a new SUBSCRIBE");
                __linphone_friend_do_subscribe(fr);
        }
        ms_message("linphone_friend_apply() done.");
index 17eb3c0042a6ac12bc558ebdcdef407a8370ee35..8fa1ec01617741deb8b0b3ebe13480f600b5f061 100644 (file)
@@ -1305,7 +1305,7 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){
                        }
                        break;
                case EXOSIP_IN_SUBSCRIPTION_NEW:
-                       ms_message("CALL_SUBSCRIPTION_NEW ");
+                       ms_message("CALL_IN_SUBSCRIPTION_NEW ");
                        sal_exosip_subscription_recv(sal,ev);
                        break;
                case EXOSIP_IN_SUBSCRIPTION_RELEASED:
index 03aef7821d767620f5e9b2314ce455f9a7b6f5f2..8b17dfea670f0e39f58aff1f695c69c29a746b1a 100644 (file)
@@ -416,7 +416,7 @@ int sal_notify_presence(SalOp *op, SalPresenceStatus status, const char *status_
 }
 
 int sal_notify_close(SalOp *op){
-       osip_message_t *msg;
+       osip_message_t *msg=NULL;
        eXosip_lock();
        eXosip_insubscription_build_notify(op->did,EXOSIP_SUBCRSTATE_TERMINATED,DEACTIVATED,&msg);
        if (msg!=NULL){
@@ -424,7 +424,8 @@ int sal_notify_close(SalOp *op){
                if (identity==NULL) identity=sal_op_get_to(op);
                osip_message_set_contact(msg,identity);
                eXosip_insubscription_send_request(op->did,msg);
-       }else ms_error("sal_notify_close(): could not create notify for incoming subscription.");
+       }else ms_error("sal_notify_close(): could not create notify for incoming subscription"
+           " did=%i, nid=%i",op->did,op->nid);
        eXosip_unlock();
        return 0;
 }
@@ -668,15 +669,16 @@ void sal_exosip_in_subscription_closed(Sal *sal, eXosip_event_t *ev){
                ms_error("Incoming subscription closed but no associated op !");
                return;
        }
+       
+       
+       sal_remove_in_subscribe(sal,op);
+       op->nid=-1;
+       op->did=-1;
        if (ev->request){
                osip_from_to_str(ev->request->from,&tmp);
                sal->callbacks.subscribe_closed(op,tmp);
                osip_free(tmp);
        }
-       
-       sal_remove_in_subscribe(sal,op);
-       op->nid=-1;
-       op->did=-1;
 }
 
 void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev){
@@ -688,6 +690,7 @@ void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev){
        sal_remove_out_subscribe(sal,op);
        op->sid=-1;
        op->did=-1;
+       sal->callbacks.notify(op,SalSubscribeTerminated, SalPresenceOffline,NULL);
 }