[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2022-01-19 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17478985#comment-17478985
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

ganeshmurthy closed pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add a core-thread facility to allow IO modules to subscribe to 
> address-reachability data
> 
>
> Key: DISPATCH-2267
> URL: https://issues.apache.org/jira/browse/DISPATCH-2267
> Project: Qpid Dispatch
>  Issue Type: Improvement
>  Components: Router Node
>Reporter: Ted Ross
>Assignee: Ted Ross
>Priority: Major
> Fix For: 1.19.0
>
>
> Add a facility to the Core Thread that allows an IO-thread module to register 
> for updates about a particular address.  Callbacks into the IO-thread (on an 
> IO thread) shall inform the module about changes to the reachability of an 
> address.
> This can be used by a protocol listener to open or close the listening socket 
> for a protocol listener based on the availability of remote connectors.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org



[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-17 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17445173#comment-17445173
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

ted-ross commented on a change in pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435#discussion_r751254686



##
File path: include/qpid/dispatch/router_core.h
##
@@ -160,6 +169,64 @@ void qdr_send_to2(qdr_core_t *core, qd_message_t *msg, 
const char *addr,
   bool exclude_inprocess, bool control);
 
 
+/**
+ **
+ * Address watch functions
+ **
+ */
+
+typedef uint32_t qdr_watch_handle_t;
+
+/**
+ * Handler for updates on watched addresses.  This function shall be invoked 
on an IO thread.
+ * 
+ * Note:  This function will be invoked when a watched address has a change in 
reachability.
+ * It is possible that the function may be called when no change occurs, 
particularly when an
+ * address is removed from the core address table.
+ *
+ * @param context The opaque context supplied in the call to 
qdr_core_watch_address
+ * @param local_consumers Number of consuming (outgoing) links for this 
address on this router
+ * @param in_proc_consumers Number of in-process consumers for this address on 
this router
+ * @param remote_consumers Number of remote routers with consumers for this 
address
+ * @param local_producers Number of producing (incoming) links for this 
address on this router
+ */
+typedef void (*qdr_address_watch_update_t)(void *context,
+   uint32_t  local_consumers,
+   uint32_t  in_proc_consumers,
+   uint32_t  remote_consumers,
+   uint32_t  local_producers);
+
+/**
+ * qdr_core_watch_address
+ *
+ * Subscribe to watch for changes in the reachability for an address.  It is 
safe to invoke this
+ * function from an IO thread.
+ * 
+ * @param core Pointer to the core module
+ * @param address The address to be watched
+ * @param aclass Address class character
+ * @param phase Address phase character ('0' .. '9')
+ * @param on_watch The handler function
+ * @param context The opaque context sent to the handler on all invocations
+ * @return Watch handle to be used when canceling the watch
+ */
+qdr_watch_handle_t qdr_core_watch_address(qdr_core_t *core,
+  const char *address,
+  characlass,
+  charphase,
+  qdr_address_watch_update_t  on_watch,
+  void   *context);
+
+/**
+ * qdr_core_unwatch_address
+ * 
+ * Cancel an address watch subscription.  It is safe to invoke this function 
from an IO thread.

Review comment:
   Yes, this is a good catch.  It will require a bit of re-work, but I'll 
make it so that this cannot happen.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add a core-thread facility to allow IO modules to subscribe to 
> address-reachability data
> 
>
> Key: DISPATCH-2267
> URL: https://issues.apache.org/jira/browse/DISPATCH-2267
> Project: Qpid Dispatch
>  Issue Type: Improvement
>  Components: Router Node
>Reporter: Ted Ross
>Assignee: Ted Ross
>Priority: Major
> Fix For: 1.19.0
>
>
> Add a facility to the Core Thread that allows an IO-thread module to register 
> for updates about a particular address.  Callbacks into the IO-thread (on an 
> IO thread) shall inform the module about changes to the reachability of an 
> address.
> This can be used by a protocol listener to open or close the listening socket 
> for a protocol listener based on the availability of remote connectors.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org



[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-17 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17445172#comment-17445172
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

ted-ross commented on a change in pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435#discussion_r751250679



##
File path: src/router_core/address_watch.c
##
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "router_core_private.h"
+#include "qpid/dispatch/amqp.h"
+
+struct qdr_address_watch_t {
+DEQ_LINKS(struct qdr_address_watch_t);
+qdr_watch_handle_t  watch_handle;
+char   *address_hash;
+qdr_address_watch_update_t  handler;
+void   *context;
+};
+
+ALLOC_DECLARE(qdr_address_watch_t);
+ALLOC_DEFINE(qdr_address_watch_t);
+
+static void qdr_watch_invoker(qdr_core_t *core, qdr_general_work_t *work);
+static void qdr_core_watch_address_CT(qdr_core_t *core, qdr_action_t *action, 
bool discard);
+static void qdr_core_unwatch_address_CT(qdr_core_t *core, qdr_action_t 
*action, bool discard);
+static void qdr_address_watch_free_CT(qdr_address_watch_t *watch);
+
+//==
+// Core Interface Functions
+//==
+qdr_watch_handle_t qdr_core_watch_address(qdr_core_t *core,
+  const char *address,
+  characlass,
+  charphase,
+  qdr_address_watch_update_t  on_watch,
+  void   *context)
+{
+static sys_atomic_t next_handle;
+qdr_action_t *action = qdr_action(qdr_core_watch_address_CT, 
"watch_address");
+
+action->args.io.address   = qdr_field(address);
+action->args.io.address_class = aclass;
+action->args.io.address_phase = phase;
+action->args.io.watch_handler = on_watch;
+action->args.io.context   = context;
+action->args.io.value32_1 = sys_atomic_inc(_handle);
+
+qdr_action_enqueue(core, action);
+return action->args.io.value32_1;
+}
+
+
+void qdr_core_unwatch_address(qdr_core_t *core, qdr_watch_handle_t handle)
+{
+qdr_action_t *action = qdr_action(qdr_core_unwatch_address_CT, 
"unwatch_address");
+
+action->args.io.value32_1 = handle;
+qdr_action_enqueue(core, action);
+}
+
+
+//==
+// In-Core API Functions
+//==
+void qdr_trigger_address_watch_CT(qdr_core_t *core, qdr_address_t *addr)
+{
+const char  *address_hash = (char*) 
qd_hash_key_by_handle(addr->hash_handle);
+qdr_address_watch_t *watch= DEQ_HEAD(core->addr_watches);
+
+while (!!watch) {
+if (strcmp(watch->address_hash, address_hash) == 0) {
+qdr_general_work_t *work = qdr_general_work(qdr_watch_invoker);
+work->watch_handler = watch->handler;
+work->context   = watch->context;
+work->local_consumers   = DEQ_SIZE(addr->rlinks);
+work->in_proc_consumers = DEQ_SIZE(addr->subscriptions);
+work->remote_consumers  = qd_bitmask_cardinality(addr->rnodes);
+work->local_producers   = DEQ_SIZE(addr->inlinks);
+qdr_post_general_work_CT(core, work);
+}
+watch = DEQ_NEXT(watch);
+}
+}
+
+void qdr_address_watch_shutdown(qdr_core_t *core)
+{
+qdr_address_watch_t *watch = DEQ_HEAD(core->addr_watches);
+while (!!watch) {
+DEQ_REMOVE(core->addr_watches, watch);
+qdr_address_watch_free_CT(watch);
+watch = DEQ_HEAD(core->addr_watches);
+}
+}
+
+
+//==
+// Local Functions

[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-16 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17444664#comment-17444664
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

kgiusti commented on a change in pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435#discussion_r750481682



##
File path: src/router_core/address_watch.c
##
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "router_core_private.h"
+#include "qpid/dispatch/amqp.h"
+
+struct qdr_address_watch_t {
+DEQ_LINKS(struct qdr_address_watch_t);
+qdr_watch_handle_t  watch_handle;
+char   *address_hash;
+qdr_address_watch_update_t  handler;
+void   *context;
+};
+
+ALLOC_DECLARE(qdr_address_watch_t);
+ALLOC_DEFINE(qdr_address_watch_t);
+
+static void qdr_watch_invoker(qdr_core_t *core, qdr_general_work_t *work);
+static void qdr_core_watch_address_CT(qdr_core_t *core, qdr_action_t *action, 
bool discard);
+static void qdr_core_unwatch_address_CT(qdr_core_t *core, qdr_action_t 
*action, bool discard);
+static void qdr_address_watch_free_CT(qdr_address_watch_t *watch);
+
+//==
+// Core Interface Functions
+//==
+qdr_watch_handle_t qdr_core_watch_address(qdr_core_t *core,
+  const char *address,
+  characlass,
+  charphase,
+  qdr_address_watch_update_t  on_watch,
+  void   *context)
+{
+static sys_atomic_t next_handle;
+qdr_action_t *action = qdr_action(qdr_core_watch_address_CT, 
"watch_address");
+
+action->args.io.address   = qdr_field(address);
+action->args.io.address_class = aclass;
+action->args.io.address_phase = phase;
+action->args.io.watch_handler = on_watch;
+action->args.io.context   = context;
+action->args.io.value32_1 = sys_atomic_inc(_handle);
+
+qdr_action_enqueue(core, action);
+return action->args.io.value32_1;
+}
+
+
+void qdr_core_unwatch_address(qdr_core_t *core, qdr_watch_handle_t handle)
+{
+qdr_action_t *action = qdr_action(qdr_core_unwatch_address_CT, 
"unwatch_address");
+
+action->args.io.value32_1 = handle;
+qdr_action_enqueue(core, action);
+}
+
+
+//==
+// In-Core API Functions
+//==
+void qdr_trigger_address_watch_CT(qdr_core_t *core, qdr_address_t *addr)
+{
+const char  *address_hash = (char*) 
qd_hash_key_by_handle(addr->hash_handle);
+qdr_address_watch_t *watch= DEQ_HEAD(core->addr_watches);
+
+while (!!watch) {
+if (strcmp(watch->address_hash, address_hash) == 0) {
+qdr_general_work_t *work = qdr_general_work(qdr_watch_invoker);
+work->watch_handler = watch->handler;
+work->context   = watch->context;
+work->local_consumers   = DEQ_SIZE(addr->rlinks);
+work->in_proc_consumers = DEQ_SIZE(addr->subscriptions);
+work->remote_consumers  = qd_bitmask_cardinality(addr->rnodes);
+work->local_producers   = DEQ_SIZE(addr->inlinks);
+qdr_post_general_work_CT(core, work);
+}
+watch = DEQ_NEXT(watch);
+}
+}
+
+void qdr_address_watch_shutdown(qdr_core_t *core)
+{
+qdr_address_watch_t *watch = DEQ_HEAD(core->addr_watches);
+while (!!watch) {
+DEQ_REMOVE(core->addr_watches, watch);
+qdr_address_watch_free_CT(watch);
+watch = DEQ_HEAD(core->addr_watches);
+}
+}
+
+
+//==
+// Local Functions

[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-16 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17444657#comment-17444657
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

kgiusti commented on a change in pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435#discussion_r750472044



##
File path: include/qpid/dispatch/router_core.h
##
@@ -160,6 +169,64 @@ void qdr_send_to2(qdr_core_t *core, qd_message_t *msg, 
const char *addr,
   bool exclude_inprocess, bool control);
 
 
+/**
+ **
+ * Address watch functions
+ **
+ */
+
+typedef uint32_t qdr_watch_handle_t;
+
+/**
+ * Handler for updates on watched addresses.  This function shall be invoked 
on an IO thread.
+ * 
+ * Note:  This function will be invoked when a watched address has a change in 
reachability.
+ * It is possible that the function may be called when no change occurs, 
particularly when an
+ * address is removed from the core address table.
+ *
+ * @param context The opaque context supplied in the call to 
qdr_core_watch_address
+ * @param local_consumers Number of consuming (outgoing) links for this 
address on this router
+ * @param in_proc_consumers Number of in-process consumers for this address on 
this router
+ * @param remote_consumers Number of remote routers with consumers for this 
address
+ * @param local_producers Number of producing (incoming) links for this 
address on this router
+ */
+typedef void (*qdr_address_watch_update_t)(void *context,
+   uint32_t  local_consumers,
+   uint32_t  in_proc_consumers,
+   uint32_t  remote_consumers,
+   uint32_t  local_producers);
+
+/**
+ * qdr_core_watch_address
+ *
+ * Subscribe to watch for changes in the reachability for an address.  It is 
safe to invoke this
+ * function from an IO thread.
+ * 
+ * @param core Pointer to the core module
+ * @param address The address to be watched
+ * @param aclass Address class character
+ * @param phase Address phase character ('0' .. '9')
+ * @param on_watch The handler function
+ * @param context The opaque context sent to the handler on all invocations
+ * @return Watch handle to be used when canceling the watch
+ */
+qdr_watch_handle_t qdr_core_watch_address(qdr_core_t *core,
+  const char *address,
+  characlass,
+  charphase,
+  qdr_address_watch_update_t  on_watch,
+  void   *context);
+
+/**
+ * qdr_core_unwatch_address
+ * 
+ * Cancel an address watch subscription.  It is safe to invoke this function 
from an IO thread.

Review comment:
   It is possible for the update handler to be invoked during or after this 
call on another I/O thread. That brings up a possible race:  whatever the 
context pointer addresses has to remain valid until we're sure that the handler 
will no longer be invoked, which isn't possible to tell from the caller's point 
of view.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add a core-thread facility to allow IO modules to subscribe to 
> address-reachability data
> 
>
> Key: DISPATCH-2267
> URL: https://issues.apache.org/jira/browse/DISPATCH-2267
> Project: Qpid Dispatch
>  Issue Type: Improvement
>  Components: Router Node
>Reporter: Ted Ross
>Assignee: Ted Ross
>Priority: Major
> Fix For: 1.19.0
>
>
> Add a facility to the Core Thread that allows an IO-thread module to register 
> for updates about a particular address.  Callbacks into the IO-thread (on an 
> IO thread) shall inform the module about changes to the reachability of an 
> address.
> This can be used by a protocol listener to open or close the listening socket 
> for a protocol listener based on the availability of remote connectors.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, 

[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-15 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17444175#comment-17444175
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

codecov-commenter edited a comment on pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435#issuecomment-967755483


   # 
[Codecov](https://codecov.io/gh/apache/qpid-dispatch/pull/1435?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#1435](https://codecov.io/gh/apache/qpid-dispatch/pull/1435?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (f63ca53) into 
[main](https://codecov.io/gh/apache/qpid-dispatch/commit/138d084d7a0d9dbeed2991ac8f669563be68?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (138d084) will **increase** coverage by `0.02%`.
   > The diff coverage is `88.77%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/graphs/tree.svg?width=650=150=pr=rk2Cgd27pP_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/qpid-dispatch/pull/1435?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
   
   ```diff
   @@Coverage Diff @@
   ## main#1435  +/-   ##
   ==
   + Coverage   84.71%   84.73%   +0.02% 
   ==
 Files 116  118   +2 
 Lines   2861728706  +89 
   ==
   + Hits2424224324  +82 
   - Misses   4375 4382   +7 
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/qpid-dispatch/pull/1435?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 | Coverage Δ | |
   |---|---|---|
   | 
[src/router\_core/route\_tables.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL3JvdXRlX3RhYmxlcy5j)
 | `81.38% <0.00%> (-0.23%)` | :arrow_down: |
   | 
[src/router\_core/modules/mobile\_sync/mobile.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL21vZHVsZXMvbW9iaWxlX3N5bmMvbW9iaWxlLmM=)
 | `92.19% <75.00%> (-0.17%)` | :arrow_down: |
   | 
[src/router\_core/address\_watch.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL2FkZHJlc3Nfd2F0Y2guYw==)
 | `87.50% <87.50%> (ø)` | |
   | 
[src/adaptors/test\_adaptor.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL2FkYXB0b3JzL3Rlc3RfYWRhcHRvci5j)
 | `100.00% <100.00%> (ø)` | |
   | 
[src/router\_core/router\_core.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL3JvdXRlcl9jb3JlLmM=)
 | `87.18% <100.00%> (+0.14%)` | :arrow_up: |
   | 
[src/adaptors/tcp\_adaptor.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL2FkYXB0b3JzL3RjcF9hZGFwdG9yLmM=)
 | `77.00% <0.00%> (-0.32%)` | :arrow_down: |
   | 
[src/parse.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3BhcnNlLmM=)
 | `87.96% <0.00%> (-0.22%)` | :arrow_down: |
   | 
[src/router\_core/connections.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL2Nvbm5lY3Rpb25zLmM=)
 | `90.00% <0.00%> (-0.01%)` | :arrow_down: |
   | 
[src/message.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL21lc3NhZ2UuYw==)
 | `87.49% <0.00%> (+0.07%)` | :arrow_up: |
   | 

[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-15 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17444132#comment-17444132
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

ted-ross commented on a change in pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435#discussion_r749717375



##
File path: src/router_core/address_watch.c
##
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "router_core_private.h"
+#include "qpid/dispatch/amqp.h"
+
+struct qdr_address_watch_t {
+DEQ_LINKS(struct qdr_address_watch_t);
+qdr_watch_handle_t  watch_handle;
+char   *address_hash;
+qdr_address_watch_update_t  handler;
+void   *context;
+};
+
+ALLOC_DECLARE(qdr_address_watch_t);
+ALLOC_DEFINE(qdr_address_watch_t);
+
+static void qdr_watch_invoker(qdr_core_t *core, qdr_general_work_t *work);
+static void qdr_core_watch_address_CT(qdr_core_t *core, qdr_action_t *action, 
bool discard);
+static void qdr_core_unwatch_address_CT(qdr_core_t *core, qdr_action_t 
*action, bool discard);
+
+//==
+// Core Interface Functions
+//==
+qdr_watch_handle_t qdr_core_watch_address(qdr_core_t *core,
+  const char *address,
+  characlass,
+  charphase,
+  qdr_address_watch_update_t  on_watch,
+  void   *context)
+{
+static sys_atomic_t next_handle;
+qdr_action_t *action = qdr_action(qdr_core_watch_address_CT, 
"watch_address");
+
+action->args.io.address   = qdr_field(address);
+action->args.io.address_class = aclass;
+action->args.io.address_phase = phase;
+action->args.io.watch_handler = on_watch;
+action->args.io.context   = context;
+action->args.io.value32_1 = sys_atomic_inc(_handle);
+
+qdr_action_enqueue(core, action);
+return action->args.io.value32_1;
+}
+
+
+void qdr_core_unwatch_address(qdr_core_t *core, qdr_watch_handle_t handle)
+{
+qdr_action_t *action = qdr_action(qdr_core_unwatch_address_CT, 
"unwatch_address");
+
+action->args.io.value32_1 = handle;
+qdr_action_enqueue(core, action);
+}
+
+
+//==
+// In-Core API Functions
+//==
+void qdr_trigger_address_watch_CT(qdr_core_t *core, qdr_address_t *addr)
+{
+const char  *address_hash = (char*) 
qd_hash_key_by_handle(addr->hash_handle);
+qdr_address_watch_t *watch= DEQ_HEAD(core->addr_watches);
+
+while (!!watch) {
+if (strcmp(watch->address_hash, address_hash) == 0) {
+qdr_general_work_t *work = qdr_general_work(qdr_watch_invoker);
+work->watch_handler = watch->handler;
+work->context   = watch->context;
+work->local_consumers   = DEQ_SIZE(addr->rlinks);
+work->in_proc_consumers = DEQ_SIZE(addr->subscriptions);
+work->remote_consumers  = qd_bitmask_cardinality(addr->rnodes);
+work->local_producers   = DEQ_SIZE(addr->inlinks);
+qdr_post_general_work_CT(core, work);
+}
+watch = DEQ_NEXT(watch);
+}
+}
+
+void qdr_address_watch_shutdown(qdr_core_t *core)
+{
+qdr_address_watch_t *watch = DEQ_HEAD(core->addr_watches);
+while (!!watch) {
+DEQ_REMOVE(core->addr_watches, watch);
+free(watch->address_hash);

Review comment:
   This is a good idea.  I'll add it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 

[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-15 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17444121#comment-17444121
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

ganeshmurthy commented on a change in pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435#discussion_r749705144



##
File path: src/router_core/address_watch.c
##
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "router_core_private.h"
+#include "qpid/dispatch/amqp.h"
+
+struct qdr_address_watch_t {
+DEQ_LINKS(struct qdr_address_watch_t);
+qdr_watch_handle_t  watch_handle;
+char   *address_hash;
+qdr_address_watch_update_t  handler;
+void   *context;
+};
+
+ALLOC_DECLARE(qdr_address_watch_t);
+ALLOC_DEFINE(qdr_address_watch_t);
+
+static void qdr_watch_invoker(qdr_core_t *core, qdr_general_work_t *work);
+static void qdr_core_watch_address_CT(qdr_core_t *core, qdr_action_t *action, 
bool discard);
+static void qdr_core_unwatch_address_CT(qdr_core_t *core, qdr_action_t 
*action, bool discard);
+
+//==
+// Core Interface Functions
+//==
+qdr_watch_handle_t qdr_core_watch_address(qdr_core_t *core,
+  const char *address,
+  characlass,
+  charphase,
+  qdr_address_watch_update_t  on_watch,
+  void   *context)
+{
+static sys_atomic_t next_handle;
+qdr_action_t *action = qdr_action(qdr_core_watch_address_CT, 
"watch_address");
+
+action->args.io.address   = qdr_field(address);
+action->args.io.address_class = aclass;
+action->args.io.address_phase = phase;
+action->args.io.watch_handler = on_watch;
+action->args.io.context   = context;
+action->args.io.value32_1 = sys_atomic_inc(_handle);
+
+qdr_action_enqueue(core, action);
+return action->args.io.value32_1;
+}
+
+
+void qdr_core_unwatch_address(qdr_core_t *core, qdr_watch_handle_t handle)
+{
+qdr_action_t *action = qdr_action(qdr_core_unwatch_address_CT, 
"unwatch_address");
+
+action->args.io.value32_1 = handle;
+qdr_action_enqueue(core, action);
+}
+
+
+//==
+// In-Core API Functions
+//==
+void qdr_trigger_address_watch_CT(qdr_core_t *core, qdr_address_t *addr)
+{
+const char  *address_hash = (char*) 
qd_hash_key_by_handle(addr->hash_handle);
+qdr_address_watch_t *watch= DEQ_HEAD(core->addr_watches);
+
+while (!!watch) {
+if (strcmp(watch->address_hash, address_hash) == 0) {
+qdr_general_work_t *work = qdr_general_work(qdr_watch_invoker);
+work->watch_handler = watch->handler;
+work->context   = watch->context;
+work->local_consumers   = DEQ_SIZE(addr->rlinks);
+work->in_proc_consumers = DEQ_SIZE(addr->subscriptions);
+work->remote_consumers  = qd_bitmask_cardinality(addr->rnodes);
+work->local_producers   = DEQ_SIZE(addr->inlinks);
+qdr_post_general_work_CT(core, work);
+}
+watch = DEQ_NEXT(watch);
+}
+}
+
+void qdr_address_watch_shutdown(qdr_core_t *core)
+{
+qdr_address_watch_t *watch = DEQ_HEAD(core->addr_watches);
+while (!!watch) {
+DEQ_REMOVE(core->addr_watches, watch);
+free(watch->address_hash);

Review comment:
   can we introduce a function called qdr_free_address_watch() or 
qdr_address_watch_free() where we free watch->address_hash and then call 
free_qdr_address_watch_t(watch); ? 
   free_qdr_address_watch_t is called from two places and so 

[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-12 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17443006#comment-17443006
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

codecov-commenter commented on pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435#issuecomment-967755483


   # 
[Codecov](https://codecov.io/gh/apache/qpid-dispatch/pull/1435?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#1435](https://codecov.io/gh/apache/qpid-dispatch/pull/1435?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (662f41f) into 
[main](https://codecov.io/gh/apache/qpid-dispatch/commit/f14a4b8d14f9c1280461ee43c306b0866f09535d?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (f14a4b8) will **decrease** coverage by `0.07%`.
   > The diff coverage is `85.43%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/graphs/tree.svg?width=650=150=pr=rk2Cgd27pP_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/qpid-dispatch/pull/1435?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
   
   ```diff
   @@Coverage Diff @@
   ## main#1435  +/-   ##
   ==
   - Coverage   84.78%   84.71%   -0.08% 
   ==
 Files 116  118   +2 
 Lines   2861328706  +93 
   ==
   + Hits2425924317  +58 
   - Misses   4354 4389  +35 
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/qpid-dispatch/pull/1435?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 | Coverage Δ | |
   |---|---|---|
   | 
[src/router\_core/route\_tables.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL3JvdXRlX3RhYmxlcy5j)
 | `81.38% <0.00%> (-0.23%)` | :arrow_down: |
   | 
[...outer\_core/modules/heartbeat\_edge/heartbeat\_edge.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL21vZHVsZXMvaGVhcnRiZWF0X2VkZ2UvaGVhcnRiZWF0X2VkZ2UuYw==)
 | `91.52% <50.00%> (-2.92%)` | :arrow_down: |
   | 
[src/router\_core/modules/mobile\_sync/mobile.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL21vZHVsZXMvbW9iaWxlX3N5bmMvbW9iaWxlLmM=)
 | `92.19% <75.00%> (-0.41%)` | :arrow_down: |
   | 
[src/router\_core/address\_watch.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL2FkZHJlc3Nfd2F0Y2guYw==)
 | `85.71% <85.71%> (ø)` | |
   | 
[src/adaptors/test\_adaptor.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL2FkYXB0b3JzL3Rlc3RfYWRhcHRvci5j)
 | `100.00% <100.00%> (ø)` | |
   | 
[src/router\_core/router\_core.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL3JvdXRlcl9jb3JlLmM=)
 | `87.18% <100.00%> (+0.14%)` | :arrow_up: |
   | 
[src/adaptors/tcp\_adaptor.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL2FkYXB0b3JzL3RjcF9hZGFwdG9yLmM=)
 | `77.21% <0.00%> (-1.90%)` | :arrow_down: |
   | 
[src/router\_core/connections.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL2Nvbm5lY3Rpb25zLmM=)
 | `89.15% <0.00%> (-0.68%)` | :arrow_down: |
   | 
[src/router\_core/forwarder.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1435/diff?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL2ZvcndhcmRlci5j)
 | `93.06% <0.00%> (-0.40%)` | 

[jira] [Commented] (DISPATCH-2267) Add a core-thread facility to allow IO modules to subscribe to address-reachability data

2021-11-12 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17442940#comment-17442940
 ] 

ASF GitHub Bot commented on DISPATCH-2267:
--

ted-ross opened a new pull request #1435:
URL: https://github.com/apache/qpid-dispatch/pull/1435


   Added API to the core header file, implemented the feature, and added a test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add a core-thread facility to allow IO modules to subscribe to 
> address-reachability data
> 
>
> Key: DISPATCH-2267
> URL: https://issues.apache.org/jira/browse/DISPATCH-2267
> Project: Qpid Dispatch
>  Issue Type: Improvement
>  Components: Router Node
>Reporter: Ted Ross
>Assignee: Ted Ross
>Priority: Major
> Fix For: 1.19.0
>
>
> Add a facility to the Core Thread that allows an IO-thread module to register 
> for updates about a particular address.  Callbacks into the IO-thread (on an 
> IO thread) shall inform the module about changes to the reachability of an 
> address.
> This can be used by a protocol listener to open or close the listening socket 
> for a protocol listener based on the availability of remote connectors.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org