mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-05 04:32:44 +00:00
Optimize how Stasis forwards are dispatched
This patch optimizes how forwards are dispatched in Stasis. Originally, forwards were dispatched as subscriptions that are invoked on the publishing thread. This did not account for the vast number of forwards we would end up having in the system, and the amount of work it would take to walk though the forward subscriptions. This patch modifies Stasis so that rather than walking the tree of forwards on every dispatch, when forwards and subscriptions are changed, the subscriber list for every topic in the tree is changed. This has a couple of benefits. First, this reduces the workload of dispatching messages. It also reduces contention when dispatching to different topics that happen to forward to the same aggregation topic (as happens with all of the channel, bridge and endpoint topics). Since forwards are no longer subscriptions, the bulk of this patch is simply changing stasis_subscription objects to stasis_forward objects (which, admittedly, I should have done in the first place.) Since this required me to yet again put in a growing array, I finally abstracted that out into a set of ast_vector macros in asterisk/vector.h. Review: https://reviewboard.asterisk.org/r/2883/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
16
main/cel.c
16
main/cel.c
@@ -121,16 +121,16 @@ static struct stasis_topic *cel_topic;
|
||||
static struct stasis_topic *cel_aggregation_topic;
|
||||
|
||||
/*! Subscription for forwarding the channel caching topic */
|
||||
static struct stasis_subscription *cel_channel_forwarder;
|
||||
static struct stasis_forward *cel_channel_forwarder;
|
||||
|
||||
/*! Subscription for forwarding the channel caching topic */
|
||||
static struct stasis_subscription *cel_bridge_forwarder;
|
||||
static struct stasis_forward *cel_bridge_forwarder;
|
||||
|
||||
/*! Subscription for forwarding the parking topic */
|
||||
static struct stasis_subscription *cel_parking_forwarder;
|
||||
static struct stasis_forward *cel_parking_forwarder;
|
||||
|
||||
/*! Subscription for forwarding the CEL-specific topic */
|
||||
static struct stasis_subscription *cel_cel_forwarder;
|
||||
static struct stasis_forward *cel_cel_forwarder;
|
||||
|
||||
struct stasis_message_type *cel_generic_type(void);
|
||||
STASIS_MESSAGE_TYPE_DEFN(cel_generic_type);
|
||||
@@ -1394,10 +1394,10 @@ static void ast_cel_engine_term(void)
|
||||
cel_aggregation_topic = NULL;
|
||||
ao2_cleanup(cel_topic);
|
||||
cel_topic = NULL;
|
||||
cel_channel_forwarder = stasis_unsubscribe_and_join(cel_channel_forwarder);
|
||||
cel_bridge_forwarder = stasis_unsubscribe_and_join(cel_bridge_forwarder);
|
||||
cel_parking_forwarder = stasis_unsubscribe_and_join(cel_parking_forwarder);
|
||||
cel_cel_forwarder = stasis_unsubscribe_and_join(cel_cel_forwarder);
|
||||
cel_channel_forwarder = stasis_forward_cancel(cel_channel_forwarder);
|
||||
cel_bridge_forwarder = stasis_forward_cancel(cel_bridge_forwarder);
|
||||
cel_parking_forwarder = stasis_forward_cancel(cel_parking_forwarder);
|
||||
cel_cel_forwarder = stasis_forward_cancel(cel_cel_forwarder);
|
||||
ast_cli_unregister(&cli_status);
|
||||
ao2_cleanup(cel_dialstatus_store);
|
||||
cel_dialstatus_store = NULL;
|
||||
|
Reference in New Issue
Block a user