[asterisk-commits] file: branch file/pimp_my_publish r391758 - /team/file/pimp_my_publish/res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 13 18:15:18 CDT 2013
Author: file
Date: Thu Jun 13 18:15:17 2013
New Revision: 391758
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391758
Log:
Create a new entity on each response.
Modified:
team/file/pimp_my_publish/res/res_sip_pubsub.c
Modified: team/file/pimp_my_publish/res/res_sip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_my_publish/res/res_sip_pubsub.c?view=diff&rev=391758&r1=391757&r2=391758
==============================================================================
--- team/file/pimp_my_publish/res/res_sip_pubsub.c (original)
+++ team/file/pimp_my_publish/res/res_sip_pubsub.c Thu Jun 13 18:15:17 2013
@@ -716,8 +716,6 @@
publication->handler = handler;
- ao2_link(handler->publications, publication);
-
return publication;
}
@@ -772,15 +770,16 @@
/* If this is not an initial publish ensure that a publication is present */
if (publish_type != SIP_PUBLISH_INITIAL) {
- if (!(publication = ao2_find(handler->publications, &entity_id, OBJ_KEY))) {
+ if (!(publication = ao2_find(handler->publications, &entity_id, OBJ_KEY | OBJ_UNLINK))) {
static const pj_str_t str_conditional_request_failed = { "Conditional Request Failed", 26 };
-
- ast_log(LOG_NOTICE, "No entity '%d'\n", entity_id);
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 412, &str_conditional_request_failed,
NULL, NULL);
return PJ_TRUE;
}
+
+ /* Per the RFC every response has to have a new entity tag */
+ publication->entity_tag = ast_atomic_fetchadd_int(&esc_etag_counter, +1);
/* Update the expires here so that the created responses will contain the correct value */
publication->expires = expires;
@@ -810,11 +809,12 @@
if (publication) {
if (expires) {
+ ao2_link(handler->publications, publication);
+
AST_SCHED_REPLACE_UNREF(publication->sched_id, sched, expires * 1000, publish_expire, publication,
ao2_ref(publication, -1), NULL, ao2_ref(publication, +1));
} else {
AST_SCHED_DEL_UNREF(sched, publication->sched_id, ao2_ref(publication, -1));
- ao2_unlink(handler->publications, publication);
}
}
More information about the asterisk-commits
mailing list