[asterisk-commits] mmichelson: branch mmichelson/pool_shark2 r381828 - in /team/mmichelson/pool_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Feb 20 11:47:57 CST 2013
Author: mmichelson
Date: Wed Feb 20 11:47:53 2013
New Revision: 381828
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381828
Log:
Add clarifying documentation.
This helps to explain how endpoint references work.
Modified:
team/mmichelson/pool_shark2/include/asterisk/res_sip.h
team/mmichelson/pool_shark2/include/asterisk/res_sip_session.h
team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c
team/mmichelson/pool_shark2/res/res_sip_session.c
Modified: team/mmichelson/pool_shark2/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/include/asterisk/res_sip.h?view=diff&rev=381828&r1=381827&r2=381828
==============================================================================
--- team/mmichelson/pool_shark2/include/asterisk/res_sip.h (original)
+++ team/mmichelson/pool_shark2/include/asterisk/res_sip.h Wed Feb 20 11:47:53 2013
@@ -730,6 +730,9 @@
* This function should never return NULL if the message is out-of-dialog. It will
* always return NULL if the message is in-dialog.
*
+ * This function will increase the reference count of the returned endpoint by one.
+ * Release your reference using the ao2_ref function when finished.
+ *
* \param rdata Out-of-dialog request or response
* \return The looked up endpoint
*/
Modified: team/mmichelson/pool_shark2/include/asterisk/res_sip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/include/asterisk/res_sip_session.h?view=diff&rev=381828&r1=381827&r2=381828
==============================================================================
--- team/mmichelson/pool_shark2/include/asterisk/res_sip_session.h (original)
+++ team/mmichelson/pool_shark2/include/asterisk/res_sip_session.h Wed Feb 20 11:47:53 2013
@@ -213,6 +213,11 @@
*
* This will take care of allocating the datastores container on the session as well
* as placing all registered supplements onto the session.
+ *
+ * The endpoint that is passed in will have its reference count increased by one since
+ * the session will be keeping a reference to the endpoint. The session will relinquish
+ * this reference when the session is destroyed.
+ *
* \param endpoint The endpoint that this session communicates with
* \param inv_session The PJSIP INVITE session data
*/
@@ -220,6 +225,10 @@
/*!
* \brief Create a new outgoing SIP session
+ *
+ * The endpoint that is passed in will have its reference count increased by one since
+ * the session will be keeping a reference to the endpoint. The session will relinquish
+ * this reference when the session is destroyed.
*
* \param endpoint The endpoint that this session uses for settings
* \param uri The URI to call
Modified: team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c?view=diff&rev=381828&r1=381827&r2=381828
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c (original)
+++ team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c Wed Feb 20 11:47:53 2013
@@ -116,6 +116,9 @@
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 501, NULL, NULL, NULL);
}
+ /* The endpoint_mod stores an endpoint reference in the mod_data of rdata. This
+ * is the only appropriate spot to actually decrement the reference.
+ */
endpoint = rdata->endpt_info.mod_data[endpoint_mod.id];
ao2_cleanup(endpoint);
pjsip_rx_data_free_cloned(rdata);
Modified: team/mmichelson/pool_shark2/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/res/res_sip_session.c?view=diff&rev=381828&r1=381827&r2=381828
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip_session.c (original)
+++ team/mmichelson/pool_shark2/res/res_sip_session.c Wed Feb 20 11:47:53 2013
@@ -740,6 +740,8 @@
pjsip_timer_setting timer;
pjsip_rdata_sdp_info *sdp_info;
pjmedia_sdp_session *local = NULL;
+
+ ast_assert(endpoint != NULL);
inv_session = pre_session_setup(rdata, endpoint);
if (!inv_session) {
More information about the asterisk-commits
mailing list