omit duplicate endpoint state events
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/70c4112a Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/70c4112a Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/70c4112a Branch: refs/heads/master Commit: 70c4112ac39d03f44d7cc1cb7df285122a6dfa97 Parents: 081336f Author: Rafael Schloming <[email protected]> Authored: Tue Jan 13 14:32:49 2015 -0500 Committer: Rafael Schloming <[email protected]> Committed: Tue Jan 13 14:32:49 2015 -0500 ---------------------------------------------------------------------- proton-c/src/engine/engine.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/70c4112a/proton-c/src/engine/engine.c ---------------------------------------------------------------------- diff --git a/proton-c/src/engine/engine.c b/proton-c/src/engine/engine.c index 896fe0d..6573e94 100644 --- a/proton-c/src/engine/engine.c +++ b/proton-c/src/engine/engine.c @@ -66,22 +66,24 @@ static pn_event_type_t endpoint_event(pn_endpoint_type_t type, bool open) { static void pn_endpoint_open(pn_endpoint_t *endpoint) { - // TODO: do we care about the current state? - PN_SET_LOCAL(endpoint->state, PN_LOCAL_ACTIVE); - pn_connection_t *conn = pn_ep_get_connection(endpoint); - pn_collector_put(conn->collector, PN_OBJECT, endpoint, - endpoint_event(endpoint->type, true)); - pn_modified(conn, endpoint, true); + if (!(endpoint->state & PN_LOCAL_ACTIVE)) { + PN_SET_LOCAL(endpoint->state, PN_LOCAL_ACTIVE); + pn_connection_t *conn = pn_ep_get_connection(endpoint); + pn_collector_put(conn->collector, PN_OBJECT, endpoint, + endpoint_event(endpoint->type, true)); + pn_modified(conn, endpoint, true); + } } static void pn_endpoint_close(pn_endpoint_t *endpoint) { - // TODO: do we care about the current state? - PN_SET_LOCAL(endpoint->state, PN_LOCAL_CLOSED); - pn_connection_t *conn = pn_ep_get_connection(endpoint); - pn_collector_put(conn->collector, PN_OBJECT, endpoint, - endpoint_event(endpoint->type, false)); - pn_modified(conn, endpoint, true); + if (!(endpoint->state & PN_LOCAL_CLOSED)) { + PN_SET_LOCAL(endpoint->state, PN_LOCAL_CLOSED); + pn_connection_t *conn = pn_ep_get_connection(endpoint); + pn_collector_put(conn->collector, PN_OBJECT, endpoint, + endpoint_event(endpoint->type, false)); + pn_modified(conn, endpoint, true); + } } void pn_connection_reset(pn_connection_t *connection) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
