mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +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:
@@ -1324,9 +1324,9 @@ static int sip_poke_noanswer(const void *data);
|
||||
static int sip_poke_peer(struct sip_peer *peer, int force);
|
||||
static void sip_poke_all_peers(void);
|
||||
static void sip_peer_hold(struct sip_pvt *p, int hold);
|
||||
static void mwi_event_cb(void *, struct stasis_subscription *, struct stasis_topic *, struct stasis_message *);
|
||||
static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message);
|
||||
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message);
|
||||
static void mwi_event_cb(void *, struct stasis_subscription *, struct stasis_message *);
|
||||
static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message);
|
||||
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message);
|
||||
static void sip_keepalive_all_peers(void);
|
||||
|
||||
/*--- Applications, functions, CLI and manager command helpers */
|
||||
@@ -16825,7 +16825,7 @@ static void sip_peer_hold(struct sip_pvt *p, int hold)
|
||||
}
|
||||
|
||||
/*! \brief Receive MWI events that we have subscribed to */
|
||||
static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
|
||||
static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
|
||||
{
|
||||
struct sip_peer *peer = userdata;
|
||||
if (stasis_subscription_final_message(sub, msg)) {
|
||||
@@ -16872,7 +16872,7 @@ static int network_change_sched_cb(const void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message)
|
||||
static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
|
||||
{
|
||||
/* This callback is only concerned with network change messages from the system topic. */
|
||||
if (stasis_message_type(message) != ast_network_change_type()) {
|
||||
@@ -28940,7 +28940,7 @@ static int restart_monitor(void)
|
||||
}
|
||||
|
||||
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub,
|
||||
struct stasis_topic *topic, struct stasis_message *message)
|
||||
struct stasis_message *message)
|
||||
{
|
||||
if (stasis_message_type(message) != ast_named_acl_change_type()) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user