]> sjero.net Git - linphone/commitdiff
fix un authenticated subscribes/notify at shutdown
authorSimon Morlat <simon.morlat@linphone.org>
Mon, 7 Feb 2011 12:59:14 +0000 (13:59 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Mon, 7 Feb 2011 12:59:14 +0000 (13:59 +0100)
coreapi/friend.c
coreapi/linphonecore.c
coreapi/sal_eXosip2_presence.c

index ee70139460ae9810b7297a8b9d27ec21f2fc3b95..527e29bd593a4bc2e5e1e6088f3e10059f508cbd 100644 (file)
@@ -277,7 +277,9 @@ SalPresenceStatus linphone_online_status_to_sal(LinphoneOnlineStatus os){
 }
 
 void linphone_friend_notify(LinphoneFriend *lf, LinphoneOnlineStatus os){
-       //printf("Wish to notify %p, lf->nid=%i\n",lf,lf->nid);
+       char *addr=linphone_address_as_string(linphone_friend_get_address(lf));
+       ms_message("Want to notify %s, insub=%p",addr,lf->insub);
+       ms_free(addr);
        if (lf->insub!=NULL){
                sal_notify_presence(lf->insub,linphone_online_status_to_sal(os),NULL);
        }
@@ -286,8 +288,6 @@ void linphone_friend_notify(LinphoneFriend *lf, LinphoneOnlineStatus os){
 static void linphone_friend_unsubscribe(LinphoneFriend *lf){
        if (lf->outsub!=NULL) {
                sal_unsubscribe(lf->outsub);
-               sal_op_release(lf->outsub);
-               lf->outsub=NULL;
                lf->subscribe_active=FALSE;
        }
 }
@@ -296,13 +296,19 @@ void linphone_friend_close_subscriptions(LinphoneFriend *lf){
        linphone_friend_unsubscribe(lf);
        if (lf->insub){
                sal_notify_close(lf->insub);
-               sal_op_release(lf->insub);
-               lf->insub=NULL;
+               
        }
 }
 
 void linphone_friend_destroy(LinphoneFriend *lf){
-       
+       if (lf->insub) {
+               sal_op_release(lf->insub);
+               lf->insub=NULL;
+       }
+       if (lf->outsub){
+               sal_op_release(lf->outsub);
+               lf->outsub=NULL;
+       }
        if (lf->uri!=NULL) linphone_address_destroy(lf->uri);
        if (lf->info!=NULL) buddy_info_free(lf->info);
        ms_free(lf);
index ad693a824f25f9529cb75b6f70542f5d163fdfd6..5d2042301505d84d1f6d148c45694c061cac7e71 100644 (file)
@@ -3850,7 +3850,6 @@ static void linphone_core_uninit(LinphoneCore *lc)
                usleep(50000);
 #endif
        }
-
        if (lc->friends)
                ms_list_for_each(lc->friends,(void (*)(void *))linphone_friend_close_subscriptions);
        linphone_core_set_state(lc,LinphoneGlobalShutdown,"Shutting down");
index 52b1485a9268e9942978a8eb5e56e80d0d87a1eb..33034ed1c47c493d018db23f33051f519152d1b5 100644 (file)
@@ -39,6 +39,7 @@ SalOp * sal_find_out_subscribe(Sal *sal, int sid){
                op=(SalOp*)elem->data;
                if (op->sid==sid) return op;
        }
+       ms_message("No op for sid %i",sid);
        return NULL;
 }