[svn-commits] file: branch file/pjsip-outbound-publish r419849 - /team/file/pjsip-outbound-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 31 08:15:36 CDT 2014


Author: file
Date: Thu Jul 31 08:15:32 2014
New Revision: 419849

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=419849
Log:
No need to copy the expiration.

Modified:
    team/file/pjsip-outbound-publish/res/res_pjsip_outbound_publish.c

Modified: team/file/pjsip-outbound-publish/res/res_pjsip_outbound_publish.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pjsip-outbound-publish/res/res_pjsip_outbound_publish.c?view=diff&rev=419849&r1=419848&r2=419849
==============================================================================
--- team/file/pjsip-outbound-publish/res/res_pjsip_outbound_publish.c (original)
+++ team/file/pjsip-outbound-publish/res/res_pjsip_outbound_publish.c Thu Jul 31 08:15:32 2014
@@ -109,8 +109,6 @@
 	pjsip_publishc *client;
 	/*! \brief Timer entry for refreshing publish */
 	pj_timer_entry timer;
-	/*! \brief Configured expiration time */
-	unsigned int expiration;
 	/*! \brief Publisher datastores set up by handlers */
 	struct ao2_container *datastores;
 	/*! \brief Queue of outgoing publish messages to send*/
@@ -176,29 +174,29 @@
 }
 
 /*! \brief Helper function which sets up the timer to send publication */
-static void schedule_publish_refresh(struct ast_sip_outbound_publish_client *client, pjsip_rx_data *rdata)
+static void schedule_publish_refresh(struct ast_sip_outbound_publish *publish, pjsip_rx_data *rdata)
 {
 	pj_time_val delay = { .sec = 0, };
 	pjsip_expires_hdr *expires;
 
-	cancel_publish_refresh(client);
+	cancel_publish_refresh(publish->state);
 
 	/* Determine when we should refresh - we favor the Expires header if possible */
 	expires = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL);
 	if (expires) {
 		delay.sec = expires->ivalue - PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH;
 	}
-	if (client->expiration && ((delay.sec > client->expiration) || !delay.sec)) {
-		delay.sec = client->expiration;
+	if (publish->expiration && ((delay.sec > publish->expiration) || !delay.sec)) {
+		delay.sec = publish->expiration;
 	}
 	if (delay.sec < PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH) {
 		delay.sec = PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH;
 	}
 
-	ao2_ref(client, +1);
-	if (pjsip_endpt_schedule_timer(ast_sip_get_pjsip_endpoint(), &client->timer, &delay) != PJ_SUCCESS) {
+	ao2_ref(publish->state, +1);
+	if (pjsip_endpt_schedule_timer(ast_sip_get_pjsip_endpoint(), &publish->state->timer, &delay) != PJ_SUCCESS) {
 		ast_log(LOG_WARNING, "Failed to pass timed publish refresh to scheduler\n");
-		ao2_ref(client, -1);
+		ao2_ref(publish->state, -1);
 	}
 }
 
@@ -570,15 +568,15 @@
 
 	ao2_lock(publish->state);
 
-	/* Remove the message currently being sent so that when the queue is serviced another will get sent */
 	if (publish->state->sending) {
+		/* Remove the message currently being sent so that when the queue is serviced another will get sent */
 		AST_LIST_REMOVE_HEAD(&publish->state->queue, entry);
 		ast_free(publish->state->sending);
 		publish->state->sending = NULL;
 	}
 
 	if (AST_LIST_EMPTY(&publish->state->queue)) {
-		schedule_publish_refresh(publish->state, param->rdata);
+		schedule_publish_refresh(publish, param->rdata);
 	}
 
 	ao2_unlock(publish->state);
@@ -668,8 +666,6 @@
 	} else if (status != PJ_SUCCESS) {
 		return -1;
 	}
-
-	publish->state->expiration = publish->expiration;
 
 	return 0;
 }




More information about the svn-commits mailing list