[asterisk-commits] mmichelson: branch mmichelson/pool_shark2 r381356 - in /team/mmichelson/pool_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Feb 13 13:13:14 CST 2013
Author: mmichelson
Date: Wed Feb 13 13:13:11 2013
New Revision: 381356
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381356
Log:
Use the threadpool serializer.
Instead of an ast_sip_work structure, we now just make
use of the ast_threadpool_serializer() API and store an
ast_taskprocessor. This helps to reduce code significantly
and using general-purpose APIs is a good thing.
In addition, I changed the transport state shutdown not to
create a serializer since it isn't necessary.
Modified:
team/mmichelson/pool_shark2/channels/chan_gulp.c
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.c
team/mmichelson/pool_shark2/res/res_sip.exports.in
team/mmichelson/pool_shark2/res/res_sip/config_transport.c
team/mmichelson/pool_shark2/res/res_sip_session.c
Modified: team/mmichelson/pool_shark2/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/channels/chan_gulp.c?view=diff&rev=381356&r1=381355&r2=381356
==============================================================================
--- team/mmichelson/pool_shark2/channels/chan_gulp.c (original)
+++ team/mmichelson/pool_shark2/channels/chan_gulp.c Wed Feb 13 13:13:11 2013
@@ -53,6 +53,7 @@
#include "asterisk/app.h"
#include "asterisk/musiconhold.h"
#include "asterisk/causes.h"
+#include "asterisk/taskprocessor.h"
#include "asterisk/res_sip.h"
#include "asterisk/res_sip_session.h"
@@ -200,7 +201,7 @@
ast_setstate(ast, AST_STATE_UP);
ao2_ref(session, +1);
- if (ast_sip_push_task(session->work, answer, session)) {
+ if (ast_sip_push_task(session->serializer, answer, session)) {
ast_log(LOG_WARNING, "Unable to push answer task to the threadpool. Cannot answer call\n");
ao2_cleanup(session);
return -1;
@@ -292,7 +293,7 @@
return -1;
}
- if (ast_sip_push_task_synchronous(session->work, fixup, &fix_data)) {
+ if (ast_sip_push_task_synchronous(session->serializer, fixup, &fix_data)) {
ast_log(LOG_WARNING, "Unable to perform channel fixup\n");
return -1;
}
@@ -427,7 +428,7 @@
if (!res && response_code) {
struct indicate_data *ind_data = indicate_data_alloc(session, condition, response_code, data, datalen);
if (ind_data) {
- res = ast_sip_push_task(session->work, indicate, ind_data);
+ res = ast_sip_push_task(session->serializer, indicate, ind_data);
if (res) {
ast_log(LOG_NOTICE, "Cannot send response code %d to endpoint %s. Could queue task properly\n",
response_code, ast_sorcery_object_get_id(session->endpoint));
@@ -505,7 +506,7 @@
struct ast_sip_session *session = ast_channel_tech_pvt(ast);
ao2_ref(session, +1);
- if (ast_sip_push_task_synchronous(session->work, call, session)) {
+ if (ast_sip_push_task_synchronous(session->serializer, call, session)) {
ast_log(LOG_WARNING, "Error attempting to place outbound call to call '%s'\n", dest);
ao2_cleanup(session);
return -1;
@@ -618,7 +619,7 @@
goto failure;
}
- if (ast_sip_push_task(session->work, hangup, h_data)) {
+ if (ast_sip_push_task(session->serializer, hangup, h_data)) {
ast_log(LOG_WARNING, "Unable to push hangup task to the threadpool. Expect bad things\n");
goto failure;
}
@@ -638,7 +639,7 @@
struct request_data {
struct ast_sip_session *session;
- struct ast_sip_work *work;
+ struct ast_taskprocessor *serializer;
const char *dest;
};
@@ -658,7 +659,7 @@
endpoint->min_se = 90;
endpoint->sess_expires = 1800;
- if (!(session = ast_sip_session_create_outgoing(endpoint, req_data->dest, req_data->work))) {
+ if (!(session = ast_sip_session_create_outgoing(endpoint, req_data->dest, req_data->serializer))) {
return -1;
}
@@ -669,18 +670,18 @@
/*! \brief Function called by core to create a new outgoing Gulp session */
static struct ast_channel *gulp_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
{
- struct ast_sip_work *work = ast_sip_create_work();
+ struct ast_taskprocessor *serializer = ast_sip_create_serializer();
struct request_data req_data;
struct ast_sip_session *session;
- if (!work) {
+ if (!serializer) {
return NULL;
}
req_data.dest = data;
- req_data.work = work;
-
- if (ast_sip_push_task_synchronous(work, request, &req_data)) {
- ast_sip_destroy_work(work);
+ req_data.serializer = serializer;
+
+ if (ast_sip_push_task_synchronous(serializer, request, &req_data)) {
+ ast_taskprocessor_unreference(serializer);
return NULL;
}
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=381356&r1=381355&r2=381356
==============================================================================
--- team/mmichelson/pool_shark2/include/asterisk/res_sip.h (original)
+++ team/mmichelson/pool_shark2/include/asterisk/res_sip.h Wed Feb 13 13:13:11 2013
@@ -39,11 +39,6 @@
struct pjsip_transport;
struct pjsip_tpfactory;
struct pjsip_tls_setting;
-
-/*!
- * \brief Opaque structure representing related SIP tasks
- */
-struct ast_sip_work;
/*!
* \brief Structure for SIP transport information
@@ -483,22 +478,19 @@
* off to them. Servant threads register themselves with PJLIB, meaning that
* they are capable of calling PJSIP and PJLIB functions if they wish.
*
- * \par ast_sip_work
+ * \par Serializer
*
* Tasks are handed off to servant threads using the API call \ref ast_sip_push_task.
- * The first parameter of this call is an \ref ast_sip_work pointer. If this pointer
+ * The first parameter of this call is a serializer. If this pointer
* is NULL, then the work will be handed off to whatever servant can currently handle
* the task. If this pointer is non-NULL, then the task will not be executed until
- * previous tasks pushed with the same \ref ast_sip_work have completed. In other words,
- * an \ref ast_sip_work is a method of serializing tasks pushed to servants. This can
- * have several benefits
- * \li Tasks are executed in the same order they were pushed to servants
- * \li Reduced contention for shared resources
+ * previous tasks pushed with the same serializer have completed. For more information
+ * on serializers and the benefits they provide, see \ref ast_threadpool_serializer
*
* \note
*
- * Do not make assumptions about individual threads based on corresponding \ref ast_sip_work.
- * In other words, just because several tasks use the same \ref ast_sip_work when being pushed
+ * Do not make assumptions about individual threads based on a corresponding serializer.
+ * In other words, just because several tasks use the same serializer when being pushed
* to servants, it does not mean that the same thread is necessarily going to execute those
* tasks, even though they are all guaranteed to be executed in sequence.
*/
@@ -514,43 +506,32 @@
int ast_sip_initialize_sorcery_auth(struct ast_sorcery *sorcery);
/*!
->>>>>>> .merge-right.r381346
- * \brief Create a new SIP work structure
- *
- * A SIP work is a means of grouping together SIP tasks. For instance, one
- * might create a SIP work so that all tasks for a given SIP dialog will
- * be grouped together. Grouping the work together ensures that the
- * servants will execute the tasks in such a way so that grouped work
- * will execute sequentially. Executing grouped tasks sequentially means
- * less contention for shared resources.
+ * \brief Create a new serializer for SIP tasks
+ *
+ * See \ref ast_threadpool_serializer for more information on serializers.
+ * SIP creates serializers so that tasks operating on similar data will run
+ * in sequence.
*
* \retval NULL Failure
- * \retval non-NULL Newly-created SIP work
- */
-struct ast_sip_work *ast_sip_create_work(void);
-
-/*!
- * \brief Destroy a SIP work structure
- *
- * \param work The SIP work to destroy
- */
-void ast_sip_destroy_work(struct ast_sip_work *work);
+ * \retval non-NULL Newly-created serializer
+ */
+struct ast_taskprocessor *ast_sip_create_serializer(void);
/*!
* \brief Pushes a task to SIP servants
*
- * This uses the SIP work provided to determine how to push the task.
- * If the work param is NULL, then the task will be pushed to the
- * servants directly. If the work is non-NULL, then the task will be
- * queued behind other tasks associated with the work.
- *
- * \param work The SIP work to which the task belongs. Can be NULL
+ * This uses the serializer provided to determine how to push the task.
+ * If the serializer is NULL, then the task will be pushed to the
+ * servants directly. If the serializer is non-NULL, then the task will be
+ * queued behind other tasks associated with the same serializer.
+ *
+ * \param serializer The serializer to which the task belongs. Can be NULL
* \param sip_task The task to execute
* \param task_data The parameter to pass to the task when it executes
* \retval 0 Success
* \retval -1 Failure
*/
-int ast_sip_push_task(struct ast_sip_work *work, int (*sip_task)(void *), void *task_data);
+int ast_sip_push_task(struct ast_taskprocessor *serializer, int (*sip_task)(void *), void *task_data);
/*!
* \brief Push a task to SIP servants and wait for it to complete
@@ -561,13 +542,13 @@
* cause a deadlock. If you are in a SIP servant thread, just call your function
* in-line.
*
- * \param work The SIP work to which the task belongs. May be NULL.
+ * \param serializer The SIP serializer to which the task belongs. May be NULL.
* \param sip_task The task to execute
* \param task_data The parameter to pass to the task when it executes
* \retval 0 Success
* \retval -1 Failure
*/
-int ast_sip_push_task_synchronous(struct ast_sip_work *work, int (*sip_task)(void *), void *task_data);
+int ast_sip_push_task_synchronous(struct ast_taskprocessor *serializer, int (*sip_task)(void *), void *task_data);
/*!
* \brief SIP body description
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=381356&r1=381355&r2=381356
==============================================================================
--- team/mmichelson/pool_shark2/include/asterisk/res_sip_session.h (original)
+++ team/mmichelson/pool_shark2/include/asterisk/res_sip_session.h Wed Feb 13 13:13:11 2013
@@ -68,8 +68,8 @@
struct ao2_container *datastores;
/* Media information */
struct ast_sip_session_media media;
- /* Workspace for tasks relating to this SIP session */
- struct ast_sip_work *work;
+ /* Serializer for tasks relating to this SIP session */
+ struct ast_taskprocessor *serializer;
};
/*!
@@ -179,18 +179,18 @@
* as placing all registered supplements onto the session.
* \param endpoint The endpoint that this session communicates with
* \param inv_session The PJSIP INVITE session data
- * \param work SIP work queue to use for this session. May be NULL.
- */
-struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint, pjsip_inv_session *inv, struct ast_sip_work *work);
+ * \param serializer SIP task queue to use for this session. May be NULL.
+ */
+struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint, pjsip_inv_session *inv, struct ast_taskprocessor *serializer);
/*!
* \brief Create a new outgoing SIP session
*
* \param endpoint The endpoint that this session uses for settings
* \param uri The URI to call
- * \param work SIP work queue to use for this session. May be NULL.
- */
-struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint *endpoint, const char *uri, struct ast_sip_work *work);
+ * \param serializer SIP task queue to use for this session. May be NULL.
+ */
+struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint *endpoint, const char *uri, struct ast_taskprocessor *serializer);
/*!
* \brief Register an SDP handler
Modified: team/mmichelson/pool_shark2/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/res/res_sip.c?view=diff&rev=381356&r1=381355&r2=381356
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip.c (original)
+++ team/mmichelson/pool_shark2/res/res_sip.c Wed Feb 13 13:13:11 2013
@@ -343,90 +343,29 @@
return 0;
}
-struct ast_sip_work {
- struct ast_taskprocessor *queue;
-};
-
-static int execute_tasks(void *data)
-{
- struct ast_sip_work *work = data;
- while (ast_taskprocessor_execute(work->queue)) {
- /* Empty on purpose */
- }
- ao2_cleanup(work);
- return 0;
-}
-
-static void work_queue_task_pushed(struct ast_taskprocessor_listener *listener, int was_empty) {
- if (was_empty) {
- struct ast_sip_work *work = ast_taskprocessor_listener_get_user_data(listener);
- ao2_ref(work, +1);
- ast_threadpool_push(sip_threadpool, execute_tasks, work);
- }
-};
-
-static int work_queue_start(struct ast_taskprocessor_listener *listener)
-{
- /* No-op */
- return 0;
-}
-
-static void work_queue_shutdown(struct ast_taskprocessor_listener *listener)
-{
- /* No-op */
-}
-
-static struct ast_taskprocessor_listener_callbacks sip_tps_listener_callbacks = {
- .task_pushed = work_queue_task_pushed,
- .start = work_queue_start,
- .shutdown = work_queue_shutdown,
-};
-
-static void work_destroy(void *obj)
-{
- struct ast_sip_work *work = obj;
- ast_taskprocessor_unreference(work->queue);
-}
-
-struct ast_sip_work *ast_sip_create_work(void)
-{
- struct ast_sip_work *work = ao2_alloc(sizeof(*work), work_destroy);
- struct ast_uuid *uuid;
- struct ast_taskprocessor_listener *listener;
- char queue_name[AST_UUID_STR_LEN];
- if (!work) {
+struct ast_taskprocessor *ast_sip_create_serializer(void)
+{
+ struct ast_taskprocessor *serializer;
+ RAII_VAR(struct ast_uuid *, uuid, ast_uuid_generate(), ast_free_ptr);
+ char name[AST_UUID_STR_LEN];
+
+ if (!uuid) {
return NULL;
}
- /* Ugh, having to name taskprocessors really makes things annoying here.
- * For all intents and purposes, no one should even know this exists. What
- * we'll do is create a UUID and use that as the name.
- */
- uuid = ast_uuid_generate();
- if (!uuid) {
- ao2_cleanup(work);
+
+ ast_uuid_to_str(uuid, name, sizeof(name));
+
+ serializer = ast_threadpool_serializer(name, sip_threadpool);
+ if (!serializer) {
return NULL;
}
- ast_uuid_to_str(uuid, queue_name, sizeof(queue_name));
- ast_free(uuid);
- listener = ast_taskprocessor_listener_alloc(&sip_tps_listener_callbacks, work);
- work->queue = ast_taskprocessor_create_with_listener(queue_name, listener);
- ao2_cleanup(listener);
- if (!work->queue) {
- ao2_cleanup(work);
- return NULL;
- }
- return work;
-}
-
-void ast_sip_destroy_work(struct ast_sip_work *work)
-{
- ao2_cleanup(work);
-}
-
-int ast_sip_push_task(struct ast_sip_work *work, int (*sip_task)(void *), void *task_data)
-{
- if (work) {
- return ast_taskprocessor_push(work->queue, sip_task, task_data);
+ return serializer;
+}
+
+int ast_sip_push_task(struct ast_taskprocessor *serializer, int (*sip_task)(void *), void *task_data)
+{
+ if (serializer) {
+ return ast_taskprocessor_push(serializer, sip_task, task_data);
} else {
return ast_threadpool_push(sip_threadpool, sip_task, task_data);
}
@@ -453,7 +392,7 @@
return std->fail;
}
-int ast_sip_push_task_synchronous(struct ast_sip_work *work, int (*sip_task)(void *), void *task_data)
+int ast_sip_push_task_synchronous(struct ast_taskprocessor *serializer, int (*sip_task)(void *), void *task_data)
{
/* This method is an onion */
struct sync_task_data std;
@@ -463,8 +402,8 @@
std.task = sip_task;
std.task_data = task_data;
- if (work) {
- if (ast_taskprocessor_push(work->queue, sync_task, &std)) {
+ if (serializer) {
+ if (ast_taskprocessor_push(serializer, sync_task, &std)) {
return -1;
}
} else {
Modified: team/mmichelson/pool_shark2/res/res_sip.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/res/res_sip.exports.in?view=diff&rev=381356&r1=381355&r2=381356
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip.exports.in (original)
+++ team/mmichelson/pool_shark2/res/res_sip.exports.in Wed Feb 13 13:13:11 2013
@@ -6,8 +6,7 @@
LINKER_SYMBOL_PREFIXast_sip_unregister_authenticator;
LINKER_SYMBOL_PREFIXast_sip_register_endpoint_identifier;
LINKER_SYMBOL_PREFIXast_sip_unregister_endpoint_identifier;
- LINKER_SYMBOL_PREFIXast_sip_create_work;
- LINKER_SYMBOL_PREFIXast_sip_destroy_work;
+ LINKER_SYMBOL_PREFIXast_sip_create_serializer;
LINKER_SYMBOL_PREFIXast_sip_push_task;
LINKER_SYMBOL_PREFIXast_sip_push_task_synchronous;
LINKER_SYMBOL_PREFIXast_sip_send_request;
Modified: team/mmichelson/pool_shark2/res/res_sip/config_transport.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/res/res_sip/config_transport.c?view=diff&rev=381356&r1=381355&r2=381356
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip/config_transport.c (original)
+++ team/mmichelson/pool_shark2/res/res_sip/config_transport.c Wed Feb 13 13:13:11 2013
@@ -38,15 +38,10 @@
static void transport_state_destroy(void *obj)
{
struct ast_sip_transport_state *state = obj;
- struct ast_sip_work *work = ast_sip_create_work();
- if (!work) {
- ast_log(LOG_WARNING, "Unable to create work structure in order to shutdown transport\n");
- }
if (state->transport) {
- ast_sip_push_task_synchronous(work, destroy_transport_state, state->transport);
- }
- ast_sip_destroy_work(work);
+ ast_sip_push_task_synchronous(NULL, destroy_transport_state, state->transport);
+ }
}
/*! \brief Destructor for transport */
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=381356&r1=381355&r2=381356
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip_session.c (original)
+++ team/mmichelson/pool_shark2/res/res_sip_session.c Wed Feb 13 13:13:11 2013
@@ -38,6 +38,7 @@
#include "asterisk/lock.h"
#include "asterisk/uuid.h"
#include "asterisk/pbx.h"
+#include "asterisk/taskprocessor.h"
#define SDP_HANDLER_BUCKETS 11
@@ -429,7 +430,7 @@
}
ast_free(supplement);
}
- ast_sip_destroy_work(session->work);
+ ast_taskprocessor_unreference(session->serializer);
ao2_cleanup(session->datastores);
AST_LIST_HEAD_DESTROY(&session->supplements);
ao2_cleanup(session->endpoint);
@@ -450,7 +451,7 @@
return 0;
}
-struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint, pjsip_inv_session *inv_session, struct ast_sip_work *work)
+struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint, pjsip_inv_session *inv_session, struct ast_taskprocessor *serializer)
{
RAII_VAR(struct ast_sip_session *, session, ao2_alloc(sizeof(*session), session_destructor), ao2_cleanup);
struct ast_sip_session_supplement *iter;
@@ -462,12 +463,12 @@
if (!session->datastores) {
return NULL;
}
- if (work) {
- session->work = work;
+ if (serializer) {
+ session->serializer = serializer;
} else {
- session->work = ast_sip_create_work();
- }
- if (!session->work) {
+ session->serializer = ast_sip_create_serializer();
+ }
+ if (!session->serializer) {
return NULL;
}
session->endpoint = endpoint;
@@ -548,7 +549,7 @@
return 0;
}
-struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint *endpoint, const char *uri, struct ast_sip_work *work)
+struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint *endpoint, const char *uri, struct ast_taskprocessor *serializer)
{
pj_str_t local_uri = pj_str("sip:temp at localhost"), remote_uri = pj_str((char*)uri);
pjsip_dialog *dlg = NULL;
@@ -610,7 +611,7 @@
return NULL;
}
- if (!(session = ast_sip_session_alloc(endpoint, inv_session, work))) {
+ if (!(session = ast_sip_session_alloc(endpoint, inv_session, serializer))) {
pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
return NULL;
}
@@ -699,7 +700,7 @@
struct new_request_data {
pjsip_rx_data *rdata;
- struct ast_sip_work *work;
+ struct ast_taskprocessor *serializer;
};
static struct new_request_data *new_request_data_alloc(pjsip_rx_data *rdata)
@@ -712,8 +713,8 @@
ast_free(nrd);
return NULL;
}
- nrd->work = ast_sip_create_work();
- if (!nrd->work) {
+ nrd->serializer = ast_sip_create_serializer();
+ if (!nrd->serializer) {
pjsip_rx_data_free_cloned(nrd->rdata);
ast_free(nrd);
return NULL;
@@ -723,7 +724,7 @@
static int handle_new_invite_request(void *data)
{
- /* The goal here is to create SIP work and throw it into
+ /* The goal here is to create a task and throw it into
* the threadpool. The threadpool callback will deal with
* actually creating a new session and all the other bells
* and whistles. Since threadpool support is not in this
@@ -732,7 +733,7 @@
*/
struct new_request_data *nrd = data;
pjsip_rx_data *rdata = nrd->rdata;
- struct ast_sip_work *work = nrd->work;
+ struct ast_taskprocessor *serializer = nrd->serializer;
pjsip_tx_data *tdata = NULL;
pjsip_inv_session *inv_session = NULL;
struct ast_sip_endpoint *endpoint = NULL;
@@ -740,7 +741,7 @@
pjsip_timer_setting timer;
pjsip_rdata_sdp_info *sdp_info;
pjmedia_sdp_session *local = NULL;
- int destroy_work = 1;
+ int destroy_serializer = 1;
endpoint = ast_sip_identify_endpoint(rdata);
if (!endpoint) {
@@ -754,7 +755,7 @@
goto end;
}
- session = ast_sip_session_alloc(endpoint, inv_session, work);
+ session = ast_sip_session_alloc(endpoint, inv_session, serializer);
if (!session) {
if (pjsip_inv_initial_answer(inv_session, rdata, 500, NULL, NULL, &tdata) == PJ_SUCCESS) {
pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
@@ -767,10 +768,10 @@
/* From this point on, any calls to pjsip_inv_terminate have the last argument as PJ_TRUE
* so that we will be notified so we can destroy the session properly
*
- * Also from this point on, the work belongs to the session, so there is no need to destroy
- * it ourselves. When the session dies, so will the work.
+ * Also from this point on, the serializer belongs to the session, so there is no need to destroy
+ * it ourselves. When the session dies, so will the serializer.
*/
- destroy_work = 0;
+ destroy_serializer = 0;
if (ast_sip_requires_authentication(endpoint, rdata)) {
pjsip_inv_initial_answer(inv_session, rdata, 401, NULL, NULL, &tdata);
@@ -857,8 +858,8 @@
handle_incoming_request(session, rdata);
end:
- if (destroy_work) {
- ast_sip_destroy_work(work);
+ if (destroy_serializer) {
+ ast_taskprocessor_unreference(serializer);
}
pjsip_rx_data_free_cloned(rdata);
ast_free(nrd);
@@ -899,11 +900,11 @@
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL);
break;
}
- if (ast_sip_push_task(nrd->work, handle_new_invite_request, nrd)) {
+ if (ast_sip_push_task(nrd->serializer, handle_new_invite_request, nrd)) {
ast_log(LOG_WARNING, "Failed to pass new INVITE to the threadpool\n");
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL);
pjsip_rx_data_free_cloned(nrd->rdata);
- ast_sip_destroy_work(nrd->work);
+ ast_taskprocessor_unreference(nrd->serializer);
ast_free(nrd);
}
break;
@@ -1083,7 +1084,7 @@
case PJSIP_EVENT_RX_MSG:
hid = handle_incoming_data_alloc(session, e->body.rx_msg.rdata);
if (hid) {
- if (ast_sip_push_task(session->work, handle_incoming, hid)) {
+ if (ast_sip_push_task(session->serializer, handle_incoming, hid)) {
ast_log(LOG_WARNING, "Failed to pass in-dialog request to threadpool\n");
ao2_cleanup(hid);
}
@@ -1099,7 +1100,7 @@
case PJSIP_EVENT_RX_MSG:
hid = handle_incoming_data_alloc(session, e->body.tsx_state.src.rdata);
if (hid) {
- if (ast_sip_push_task(session->work, handle_incoming, hid)) {
+ if (ast_sip_push_task(session->serializer, handle_incoming, hid)) {
ast_log(LOG_WARNING, "Failed to pass in-dialog request to threadpool\n");
ao2_cleanup(hid);
}
@@ -1123,7 +1124,7 @@
}
if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
- if (ast_sip_push_task(session->work, session_end, session)) {
+ if (ast_sip_push_task(session->serializer, session_end, session)) {
ast_log(LOG_WARNING, "Failed to push session end task to threadpool. Ending session in-thread\n");
session_end(session);
}
@@ -1229,7 +1230,7 @@
/* PJSIP requires us to have set an SDP answer when this returns, so we have to push this
* task synchronously
*/
- if (ast_sip_push_task_synchronous(session->work, on_rx_offer, &orod)) {
+ if (ast_sip_push_task_synchronous(session->serializer, on_rx_offer, &orod)) {
ast_log(LOG_WARNING, "Synchronous threadpool task to create SDP answer failed. Using saved local SDP\n");
}
}
@@ -1285,7 +1286,7 @@
if (!mud) {
return;
}
- if (ast_sip_push_task(session->work, on_media_update, mud)) {
+ if (ast_sip_push_task(session->serializer, on_media_update, mud)) {
ast_log(LOG_WARNING, "Failed to pass media update task to the threadpool\n");
ao2_cleanup(mud);
}
More information about the asterisk-commits
mailing list