Fixed reloading of interfaces with SIP support
authorAndreas Eversberg <jolly@eversberg.eu>
Sun, 20 May 2012 14:36:06 +0000 (16:36 +0200)
committerAndreas Eversberg <jolly@eversberg.eu>
Sun, 20 May 2012 14:36:06 +0000 (16:36 +0200)
SIP instance is now moved to new interface list at is should be.

interface.c
sip.cpp

index 4c340d2..0264f46 100644 (file)
@@ -1583,16 +1583,15 @@ void relink_interfaces(void)
        struct mISDNport *mISDNport;
        struct interface_port *ifport;
 #endif
-       struct interface *interface, *temp;
-       int found;
+       struct interface *interface, *temp, *found;
 
        interface = interface_first;
        while(interface) {
-               found = 0;
+               found = NULL;
                temp = interface_newlist;
                while(temp) {
                        if (!strcmp(temp->name, interface->name))
-                               found = 1;
+                               found = temp;
                        temp = temp->next;
                }
                if (!found) {
@@ -1608,17 +1607,26 @@ void relink_interfaces(void)
                        if (interface->sip)
                                sip_exit_inst(interface);
 #endif
+               } else {
+#ifdef WITH_SIP
+                       if (interface->sip) {
+                               /* move sip instance, if we keep interface */
+                               found->sip_inst = interface->sip_inst;
+                               interface->sip_inst = NULL;
+                       }
+#endif
+                       ;
                }
                interface = interface->next;
        }
 
        interface = interface_newlist;
        while(interface) {
-               found = 0;
+               found = NULL;
                temp = interface_first;
                while(temp) {
                        if (!strcmp(temp->name, interface->name))
-                               found = 1;
+                               found = temp;
                        temp = temp->next;
                }
                if (!found) {
diff --git a/sip.cpp b/sip.cpp
index a385988..5358fb4 100644 (file)
--- a/sip.cpp
+++ b/sip.cpp
@@ -62,6 +62,8 @@ Psip::Psip(int type, char *portname, struct port_settings *settings, struct inte
        p_s_rtp_tx_action = 0;
 
        PDEBUG(DEBUG_SIP, "Created new Psip(%s).\n", portname);
+       if (!p_s_sip_inst)
+               FATAL("No SIP instance for interface\n");
 }