Author: tross
Date: Thu Dec 13 21:03:59 2012
New Revision: 1421531
URL: http://svn.apache.org/viewvc?rev=1421531&view=rev
Log:
PROTON-180 - Add a driver function to observe/reset the activation status of a
connector.
This new function is on support of, and should only be used for
non-amqp connectors.
Modified:
qpid/proton/trunk/proton-c/include/proton/driver.h
qpid/proton/trunk/proton-c/src/driver.c
Modified: qpid/proton/trunk/proton-c/include/proton/driver.h
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/driver.h?rev=1421531&r1=1421530&r2=1421531&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/driver.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/driver.h Thu Dec 13 21:03:59 2012
@@ -358,6 +358,22 @@ void pn_connector_free(pn_connector_t *c
*/
void pn_connector_activate(pn_connector_t *connector, pn_activate_criteria_t
criteria);
+/** Return the activation status of the connector for a criteria
+ *
+ * Return the activation status (i.e. readable, writable) for the connector.
This function
+ * has the side-effect of canceling the activation of the criteria.
+ *
+ * Please note that this function must not be used for normal AMQP connectors.
It is only
+ * used for connectors created so the driver can track non-AMQP file
descriptors. Such
+ * connectors are never passed into pn_connector_process.
+ *
+ * @param[in] connector The connector object to activate
+ * @param[in] criteria The criteria to test. "Is this the reason the
connector appeared
+ * in the work list?"
+ * @return true iff the criteria is activated on the connector.
+ */
+bool pn_connector_activated(pn_connector_t *connector, pn_activate_criteria_t
criteria);
+
#ifdef __cplusplus
}
Modified: qpid/proton/trunk/proton-c/src/driver.c
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/driver.c?rev=1421531&r1=1421530&r2=1421531&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/driver.c (original)
+++ qpid/proton/trunk/proton-c/src/driver.c Thu Dec 13 21:03:59 2012
@@ -580,6 +580,28 @@ void pn_connector_activate(pn_connector_
}
+bool pn_connector_activated(pn_connector_t *ctor, pn_activate_criteria_t crit)
+{
+ bool result = false;
+
+ switch (crit) {
+ case PN_CONNECTOR_WRITABLE :
+ result = ctor->pending_write;
+ ctor->pending_write = false;
+ ctor->status &= ~PN_SEL_WR;
+ break;
+
+ case PN_CONNECTOR_READABLE :
+ result = ctor->pending_read;
+ ctor->pending_read = false;
+ ctor->status &= ~PN_SEL_RD;
+ break;
+ }
+
+ return result;
+}
+
+
static void pn_connector_write(pn_connector_t *ctor)
{
if (ctor->output_size > 0) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]