]> sjero.net Git - linphone/commitdiff
uPnP improvements
authorYann Diorcet <yann.diorcet@belledonne-communications.com>
Thu, 28 Feb 2013 09:44:32 +0000 (10:44 +0100)
committerYann Diorcet <yann.diorcet@belledonne-communications.com>
Thu, 28 Feb 2013 09:44:32 +0000 (10:44 +0100)
Fix mutex lock in the destructor
Add firewall commands in console

console/commands.c
coreapi/upnp.c
mediastreamer2

index a91c58c447cc5ba706d83e93308c9d37e47005d6..22b09a5a6b92e89ec3feea40a9deb089197e9fea 100644 (file)
@@ -244,6 +244,8 @@ static LPC_COMMAND commands[] = {
                "'firewall none'   : use direct connection.\n"
                "'firewall nat'    : use nat address given with the 'nat' command.\n"
                "'firewall stun'   : use stun server given with the 'stun' command.\n"
+               "'firewall ice'    : use ice.\n"
+               "'firewall upnp'   : use uPnP IGD.\n"
        },
        { "call-logs", lpc_cmd_call_logs, "Calls history", NULL },
        { "friend", lpc_cmd_friend, "Manage friends",
@@ -850,6 +852,10 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
                {
                        linphone_core_set_firewall_policy(lc,LinphonePolicyNoFirewall);
                }
+               else if (strcmp(args,"upnp")==0) 
+               {
+                       linphone_core_set_firewall_policy(lc,LinphonePolicyUseUpnp);
+               }
                else if (strcmp(args,"ice")==0)
                {
                        setting = linphone_core_get_stun_server(lc);
index 86d16d0f07bc815471b736bf76b71d87a05afb4f..28477b4deec17b355ddc2290c4962a105378e76b 100644 (file)
@@ -309,15 +309,14 @@ void linphone_upnp_context_destroy(UpnpContext *lupnp) {
                ms_message("uPnP IGD: Wait all pending port bindings ...");
                ms_cond_wait(&lupnp->empty_cond, &lupnp->mutex);
        }
+       ms_mutex_unlock(&lupnp->mutex);
 
        if(lupnp->upnp_igd_ctxt != NULL) {
-               // upnp_igd_destroy is synchronous so the callbacks will be called in the same thread.
-               // So release the mutex before upnp_igd_destroy call. 
-               ms_mutex_unlock(&lupnp->mutex);
                upnp_igd_destroy(lupnp->upnp_igd_ctxt);
-               ms_mutex_lock(&lupnp->mutex);
                lupnp->upnp_igd_ctxt = NULL;
        }
+       
+       /* No more multi threading here */
 
        /* Run one more time configuration update and proxy */
        linphone_upnp_update_config(lupnp);
@@ -345,8 +344,6 @@ void linphone_upnp_context_destroy(UpnpContext *lupnp) {
        ms_list_for_each(lupnp->pending_bindings,(void (*)(void*))linphone_upnp_port_binding_release);
        lupnp->pending_bindings = ms_list_free(lupnp->pending_bindings);
        
-       ms_mutex_unlock(&lupnp->mutex);
-
        ms_mutex_destroy(&lupnp->mutex);
        ms_cond_destroy(&lupnp->empty_cond);
 
index e033b06a731d0b9bc4e69afc690f6469eae73f66..8d85a5ded3b18e2d3d4ba22ee75e0f1ef9c0f739 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e033b06a731d0b9bc4e69afc690f6469eae73f66
+Subproject commit 8d85a5ded3b18e2d3d4ba22ee75e0f1ef9c0f739