]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Change the fd on the I/O context in case it changed during the reload, which is indee...
authorJoshua Colp <jcolp@digium.com>
Mon, 2 Oct 2006 20:07:59 +0000 (20:07 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 2 Oct 2006 20:07:59 +0000 (20:07 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@44213 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 656034cd92fbea1a94fec72f720e8c345e0d11ab..b5ce792c64f6386a72d67691c505353eea050bc1 100644 (file)
@@ -438,6 +438,7 @@ static int expiry = DEFAULT_EXPIRY;
 
 static struct sched_context *sched;
 static struct io_context *io;
+static int *sipsock_read_id;
 
 #define SIP_MAX_HEADERS                64                      /*!< Max amount of SIP headers to read */
 #define SIP_MAX_LINES          64                      /*!< Max amount of lines in SIP attachment (like SDP) */
@@ -11441,7 +11442,7 @@ static void *do_monitor(void *data)
 
        /* Add an I/O event to our UDP socket */
        if (sipsock > -1) 
-               ast_io_add(io, sipsock, sipsock_read, AST_IO_IN, NULL);
+               sipsock_read_id = ast_io_add(io, sipsock, sipsock_read, AST_IO_IN, NULL);
        
        /* This thread monitors all the frame relay interfaces which are not yet in use
           (and thus do not have a separate thread) indefinitely */
@@ -11456,6 +11457,10 @@ static void *do_monitor(void *data)
                        if (option_verbose > 0)
                                ast_verbose(VERBOSE_PREFIX_1 "Reloading SIP\n");
                        sip_do_reload();
+
+                       /* Change the I/O fd of our UDP socket */
+                       if (sipsock > -1)
+                               sipsock_read_id = ast_io_change(io, sipsock_read_id, sipsock, NULL, 0, NULL);
                }
                /* Check for interfaces needing to be killed */
                ast_mutex_lock(&iflock);