[Asterisk-code-review] endpoint/stasis: Eliminate duplicate events on endpoint stat... (asterisk[13])

Mark Michelson asteriskteam at digium.com
Wed May 27 15:00:29 CDT 2015


Mark Michelson has posted comments on this change.

Change subject: endpoint/stasis: Eliminate duplicate events on endpoint status change
......................................................................


Patch Set 2: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/541/2/main/stasis_cache_pattern.c
File main/stasis_cache_pattern.c:

Line 136: struct stasis_cp_single *stasis_cp_single_create(struct stasis_cp_all *all,
        : 	const char *name)
        : {
        : 	RAII_VAR(struct stasis_cp_single *, one, NULL, ao2_cleanup);
        : 
        : 	one = ao2_t_alloc(sizeof(*one), one_dtor, name);
        : 	if (!one) {
        : 		return NULL;
        : 	}
        : 
        : 	one->topic = stasis_topic_create(name);
        : 	if (!one->topic) {
        : 		return NULL;
        : 	}
        : 	one->topic_cached = stasis_caching_topic_create(one->topic, all->cache);
        : 	if (!one->topic_cached) {
        : 		return NULL;
        : 	}
        : 
        : 	one->forward_topic_to_all = stasis_forward_all(one->topic, all->topic);
        : 	if (!one->forward_topic_to_all) {
        : 		return NULL;
        : 	}
        : 	one->forward_cached_to_all = stasis_forward_all(
        : 		stasis_caching_get_topic(one->topic_cached), all->topic_cached);
        : 	if (!one->forward_cached_to_all) {
        : 		return NULL;
        : 	}
        : 
        : 	ao2_ref(one, +1);
        : 	return one;
        : }
Since stasis_cp_single_create_only() and stasis_cp_single_forward() are the building blocks for this function, I think the body of this function could be axed in favor of just calling those two functions. Something like:

    one = stasis_single_create_only(all, name);
    stasis_cp_single_forward(one, all);
    return one;

(plus requisite error checking/reference adjustment of course)


-- 
To view, visit https://gerrit.asterisk.org/541
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I26d7d4926a0861748fd3bdffe316b75b549a801c
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: David M. Lee <dlee at digium.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list