[ 
https://issues.apache.org/jira/browse/DISPATCH-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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,
+                                          char                        aclass,
+                                          char                        phase,
+                                          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, e-mail: dev-h...@qpid.apache.org

Reply via email to