[asterisk-commits] rizzo: branch rizzo/astobj2 r47227 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Nov 6 09:40:25 MST 2006


Author: rizzo
Date: Mon Nov  6 10:40:25 2006
New Revision: 47227

URL: http://svn.digium.com/view/asterisk?rev=47227&view=rev
Log:
document the usage of netlock, which seems to be useless.

trunk candidate.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?rev=47227&r1=47226&r2=47227&view=diff
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Mon Nov  6 10:40:25 2006
@@ -559,6 +559,16 @@
 
 static struct ast_flags global_flags[2] = {{0}};        /*!< global SIP_ flags */
 
+/*!
+ * netlock protects changes to the socket used for SIP communications
+ * while it is being used.
+ * XXX This is a very expensive solution to use,
+ * because it forces us to a lock/unlock around each instance of find_call(),
+ * for something (sip_reload with a change of address) which is rarely used.
+ * Given that, if we change address, all incoming traffic is bound to
+ * fail anyways, we could as well forget about the lock and just drop
+ * the transmission if sipsock = -1
+ */
 AST_MUTEX_DEFINE_STATIC(netlock);
 
 /*! \brief Protect the monitoring thread, so only one process can kill or start it, and not
@@ -577,7 +587,7 @@
 
 static struct sched_context *sched;     /*!< The scheduling context */
 static struct io_context *io;           /*!< The IO context */
-static int *sipsock_read_id;            /*!< ID of IO entry for sipsock FD */
+static int *sipsock_read_id;            /*!< ID of IO entry for sipsock FD. XXX never used */
 
 #define DEC_CALL_LIMIT	0
 #define INC_CALL_LIMIT	1
@@ -14668,6 +14678,12 @@
 		return 1;
 
 	/* Process request, with netlock held, and with usual deadlock avoidance */
+	/* XXX we would like to call find_call() first, and then acquire the netlock
+	 * afterwards. However, in some situations (creating new dialogs, basically)
+	 * find_call sends a message, so we need to run it with netlock held.
+	 * This said, netlock is probably useless (see the comment near its
+	 * declaration) and we could as well forget about it.
+	 */
 	for (lockretry = 100; lockretry > 0; lockretry--) {
 		ast_mutex_lock(&netlock);
 



More information about the asterisk-commits mailing list