[asterisk-commits] oej: branch group/pinana-publish-1.4 r297584 - /team/group/pinana-publish-1.4...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 5 13:07:07 CST 2010


Author: oej
Date: Sun Dec  5 13:07:02 2010
New Revision: 297584

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=297584
Log:
- Add missing REF
- Add presence scheduler (that's not used yet)

Modified:
    team/group/pinana-publish-1.4/channels/chan_sip.c

Modified: team/group/pinana-publish-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinana-publish-1.4/channels/chan_sip.c?view=diff&rev=297584&r1=297583&r2=297584
==============================================================================
--- team/group/pinana-publish-1.4/channels/chan_sip.c (original)
+++ team/group/pinana-publish-1.4/channels/chan_sip.c Sun Dec  5 13:07:02 2010
@@ -696,6 +696,7 @@
 static enum channelreloadreason sip_reloadreason;       /*!< Reason for last reload/load of configuration */
 
 static struct sched_context *sched;     /*!< The scheduling context */
+static struct sched_context *pres_sched;     /*!< The scheduling context for presence */
 static struct io_context *io;           /*!< The IO context */
 static int *sipsock_read_id;            /*!< ID of IO entry for sipsock FD */
 
@@ -10149,6 +10150,14 @@
 {
 	struct statechange *sc = NULL;
 
+	/* Initializing this thread */
+	if (!(pres_sched = sched_context_create())) {
+		ast_log(LOG_ERROR, "Unable to create scheduler context\n");
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
+
+	/* Running this thread */
 	while (!device_state.stop) {
 		ast_mutex_lock(&device_state.lock);
 		if (!(sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry))) {
@@ -10172,6 +10181,7 @@
 		sc = NULL;
 	}
 
+	/* Stopping this thread */
 	if (sc) {
 		free(sc);
 	}
@@ -10179,6 +10189,7 @@
 	while ((sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry))) {
 		free(sc);
 	}
+	sched_context_destroy(pres_sched);
 
 	return NULL;
 }
@@ -19534,7 +19545,6 @@
 	}
 	if (ast_string_field_init(pres, 256)) {
 		ast_log(LOG_DEBUG, "--- Can't initialize string field in pres structure\n");
-		ASTOBJ_UNREF(pres, sip_subscribe_pres_destroy);
 		return 0;
 	}
 	
@@ -19568,6 +19578,7 @@
 	}
 	ast_log(LOG_DEBUG, "--- subscription %s about to start\n", pres->uri);
 	
+	ASTOBJ_REF(pres);
 	pres->resub = -1;
 	__sip_subscribe_pres_do(pres);
 	ASTOBJ_UNREF(pres, sip_subscribe_pres_destroy);




More information about the asterisk-commits mailing list