You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2018/10/25 20:01:45 UTC
qpid-dispatch git commit: DISPATCH-1156 - Prevent spurious data links
from being created on the edge uplink connection.
Repository: qpid-dispatch
Updated Branches:
refs/heads/master 04d2aa0fb -> 302f8d148
DISPATCH-1156 - Prevent spurious data links from being created on the edge uplink connection.
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/302f8d14
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/302f8d14
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/302f8d14
Branch: refs/heads/master
Commit: 302f8d14871e80f57fc8d5f93297246cfd12bbbf
Parents: 04d2aa0
Author: Ted Ross <tr...@redhat.com>
Authored: Thu Oct 25 15:54:43 2018 -0400
Committer: Ted Ross <tr...@redhat.com>
Committed: Thu Oct 25 15:55:28 2018 -0400
----------------------------------------------------------------------
src/router_core/core_events.h | 10 +++--
.../modules/edge_router/addr_proxy.c | 46 +++++++++++++++-----
src/router_core/router_core.c | 10 ++++-
3 files changed, 49 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/302f8d14/src/router_core/core_events.h
----------------------------------------------------------------------
diff --git a/src/router_core/core_events.h b/src/router_core/core_events.h
index 64f8b52..67f2fca 100644
--- a/src/router_core/core_events.h
+++ b/src/router_core/core_events.h
@@ -56,8 +56,10 @@ typedef uint32_t qdrc_event_t;
* QDRC_EVENT_ADDR_NO_LONGER_DEST An address transitioned from one to zero destinations
* QDRC_EVENT_ADDR_ONE_LOCAL_DEST An address transitioned from N destinations to one local dest
* QDRC_EVENT_ADDR_TWO_DEST An address transisioned from one local dest to two destinations
- * QDRC_EVENT_ADDR_BECAME_SOURCE An address transitioner from zero to one local source (inlink)
- * QDRC_EVENT_ADDR_NO_LONGER_SOURCE An address transitioner from one to zero local sources (inlink)
+ * QDRC_EVENT_ADDR_BECAME_SOURCE An address transitioned from zero to one local source (inlink)
+ * QDRC_EVENT_ADDR_NO_LONGER_SOURCE An address transitioned from one to zero local sources (inlink)
+ * QDRC_EVENT_ADDR_TWO_SOURCE An address transitioned from one to two local sources (inlink)
+ * QDRC_EVENT_ADDR_ONE_SOURCE An address transitioned from two to one local sources (inlink)
*/
#define QDRC_EVENT_CONN_OPENED 0x00000001
@@ -86,7 +88,9 @@ typedef uint32_t qdrc_event_t;
#define QDRC_EVENT_ADDR_TWO_DEST 0x00800000
#define QDRC_EVENT_ADDR_BECAME_SOURCE 0x01000000
#define QDRC_EVENT_ADDR_NO_LONGER_SOURCE 0x02000000
-#define _QDRC_EVENT_ADDR_RANGE 0x03FF0000
+#define QDRC_EVENT_ADDR_TWO_SOURCE 0x04000000
+#define QDRC_EVENT_ADDR_ONE_SOURCE 0x08000000
+#define _QDRC_EVENT_ADDR_RANGE 0x0FFF0000
/**
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/302f8d14/src/router_core/modules/edge_router/addr_proxy.c
----------------------------------------------------------------------
diff --git a/src/router_core/modules/edge_router/addr_proxy.c b/src/router_core/modules/edge_router/addr_proxy.c
index 3859091..2f82b94 100644
--- a/src/router_core/modules/edge_router/addr_proxy.c
+++ b/src/router_core/modules/edge_router/addr_proxy.c
@@ -113,14 +113,16 @@ static void del_inlink(qcm_edge_addr_proxy_t *ap, qdr_address_t *addr)
static void add_outlink(qcm_edge_addr_proxy_t *ap, const char *key, qdr_address_t *addr)
{
- //
- // Note that this link must not be bound to the address at this time. That will
- // happen later when the interior tells us that there are upstream destinations
- // for the address (see on_transfer below).
- //
- qdr_link_t *link = qdr_create_link_CT(ap->core, ap->uplink_conn, QD_LINK_ENDPOINT, QD_OUTGOING,
- qdr_terminus_normal(0), qdr_terminus_normal(key + 2));
- addr->edge_outlink = link;
+ if (addr->edge_outlink == 0) {
+ //
+ // Note that this link must not be bound to the address at this time. That will
+ // happen later when the interior tells us that there are upstream destinations
+ // for the address (see on_transfer below).
+ //
+ qdr_link_t *link = qdr_create_link_CT(ap->core, ap->uplink_conn, QD_LINK_ENDPOINT, QD_OUTGOING,
+ qdr_terminus_normal(0), qdr_terminus_normal(key + 2));
+ addr->edge_outlink = link;
+ }
}
@@ -208,8 +210,14 @@ static void on_conn_event(void *context, qdrc_event_t event, qdr_connection_t *c
// If the address has more than zero attached sources, create an outgoing link
// to the interior to signal the presence of local producers.
//
- if (DEQ_SIZE(addr->inlinks) > 0)
- add_outlink(ap, key, addr);
+ if (DEQ_SIZE(addr->inlinks) > 0) {
+ if (DEQ_SIZE(addr->inlinks) == 1) {
+ qdr_link_ref_t *ref = DEQ_HEAD(addr->inlinks);
+ if (ref->link->conn != ap->uplink_conn)
+ add_outlink(ap, key, addr);
+ } else
+ add_outlink(ap, key, addr);
+ }
}
addr = DEQ_NEXT(addr);
}
@@ -276,13 +284,25 @@ static void on_addr_event(void *context, qdrc_event_t event, qdr_address_t *addr
break;
case QDRC_EVENT_ADDR_BECAME_SOURCE :
- add_outlink(ap, key, addr);
+ link_ref = DEQ_HEAD(addr->inlinks);
+ if (link_ref->link->conn != ap->uplink_conn)
+ add_outlink(ap, key, addr);
break;
case QDRC_EVENT_ADDR_NO_LONGER_SOURCE :
del_outlink(ap, addr);
break;
+ case QDRC_EVENT_ADDR_TWO_SOURCE :
+ add_outlink(ap, key, addr);
+ break;
+
+ case QDRC_EVENT_ADDR_ONE_SOURCE :
+ link_ref = DEQ_HEAD(addr->inlinks);
+ if (link_ref->link->conn == ap->uplink_conn)
+ del_outlink(ap, addr);
+ break;
+
default:
assert(false);
break;
@@ -386,7 +406,9 @@ qcm_edge_addr_proxy_t *qcm_edge_addr_proxy(qdr_core_t *core)
| QDRC_EVENT_ADDR_ONE_LOCAL_DEST
| QDRC_EVENT_ADDR_TWO_DEST
| QDRC_EVENT_ADDR_BECAME_SOURCE
- | QDRC_EVENT_ADDR_NO_LONGER_SOURCE,
+ | QDRC_EVENT_ADDR_NO_LONGER_SOURCE
+ | QDRC_EVENT_ADDR_TWO_SOURCE
+ | QDRC_EVENT_ADDR_ONE_SOURCE,
on_conn_event,
0,
on_addr_event,
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/302f8d14/src/router_core/router_core.c
----------------------------------------------------------------------
diff --git a/src/router_core/router_core.c b/src/router_core/router_core.c
index 76ceba9..58135a3 100644
--- a/src/router_core/router_core.c
+++ b/src/router_core/router_core.c
@@ -427,6 +427,8 @@ void qdr_core_bind_address_link_CT(qdr_core_t *core, qdr_address_t *addr, qdr_li
qdr_add_link_ref(&addr->inlinks, link, QDR_LINK_LIST_CLASS_ADDRESS);
if (DEQ_SIZE(addr->inlinks) == 1)
qdrc_event_addr_raise(core, QDRC_EVENT_ADDR_BECAME_SOURCE, addr);
+ else if (DEQ_SIZE(addr->inlinks) == 2)
+ qdrc_event_addr_raise(core, QDRC_EVENT_ADDR_TWO_SOURCE, addr);
}
}
@@ -446,8 +448,12 @@ void qdr_core_unbind_address_link_CT(qdr_core_t *core, qdr_address_t *addr, qdr_
qdrc_event_addr_raise(core, QDRC_EVENT_ADDR_ONE_LOCAL_DEST, addr);
} else {
bool removed = qdr_del_link_ref(&addr->inlinks, link, QDR_LINK_LIST_CLASS_ADDRESS);
- if (removed && DEQ_SIZE(addr->inlinks) == 0)
- qdrc_event_addr_raise(core, QDRC_EVENT_ADDR_NO_LONGER_SOURCE, addr);
+ if (removed) {
+ if (DEQ_SIZE(addr->inlinks) == 0)
+ qdrc_event_addr_raise(core, QDRC_EVENT_ADDR_NO_LONGER_SOURCE, addr);
+ else if (DEQ_SIZE(addr->inlinks) == 1)
+ qdrc_event_addr_raise(core, QDRC_EVENT_ADDR_ONE_SOURCE, addr);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org