mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-01 18:09:41 +00:00
Remove dispatch object allocation from Stasis publishing
While looking for areas for performance improvement, I realized that an unused feature in Stasis was negatively impacting performance. When a message is sent to a subscriber, a dispatch object is allocated for the dispatch, containing the topic the message was published to, the subscriber the message is being sent to, and the message itself. The topic is actually unused by any subscriber in Asterisk today. And the subscriber is associated with the taskprocessor the message is being dispatched to. First, this patch removes the unused topic parameter from Stasis subscription callbacks. Second, this patch introduces the concept of taskprocessor local data, data that may be set on a taskprocessor and provided along with the data pointer when a task is pushed using the ast_taskprocessor_push_local() call. This allows the task to have both data specific to that taskprocessor, in addition to data specific to that invocation. With those two changes, the dispatch object can be removed completely, and the message is simply refcounted and sent directly to the taskprocessor. Review: https://reviewboard.asterisk.org/r/2884/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -184,14 +184,13 @@ static int find_route(
|
||||
|
||||
static void router_dispatch(void *data,
|
||||
struct stasis_subscription *sub,
|
||||
struct stasis_topic *topic,
|
||||
struct stasis_message *message)
|
||||
{
|
||||
struct stasis_message_router *router = data;
|
||||
struct stasis_message_route route;
|
||||
|
||||
if (find_route(router, message, &route) == 0) {
|
||||
route.callback(route.data, sub, topic, message);
|
||||
route.callback(route.data, sub, message);
|
||||
}
|
||||
|
||||
if (stasis_subscription_final_message(sub, message)) {
|
||||
|
Reference in New Issue
Block a user