From ba6d46d3c1c54571f32ddb79593ed78b53e7e21c Mon Sep 17 00:00:00 2001
Message-Id: <ba6d46d3c1c54571f32ddb79593ed78b53e7e21c.1348657454.git.ibell@...>
In-Reply-To: <6456222f7ea01be922ce869d84b615bcc03cc79c.1348657454.git.ibell@...>
References: <6456222f7ea01be922ce869d84b615bcc03cc79c.1348657454.git.ibell@...>
From: Ian Bell <ibell@...>
Date: Wed, 26 Sep 2012 11:34:46 +0100
Subject: [PATCH 2/6] [mama] Rethread Quality callback
The subscription OnQuality callback always fired off the transport thread
due to a disconnect, and off the subscription thread due to a gap. This
patch re-enqueues the callback for transport disconnect so that all
subscription callacks happen from the subscription thread.
Signed-off-by: Ian Bell <ibell@...>
---
mama/c_cpp/src/c/transport.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c
index 5319999..c54a94c 100644
--- a/mama/c_cpp/src/c/transport.c
+++ b/mama/c_cpp/src/c/transport.c
@@ -1678,11 +1678,22 @@ mamaTransportImpl_getTransportTopicCallback (mamaTransport transport,
}
static void
+staleEventCallback (mamaQueue queue, void* closure)
+{
+ mamaSubscription sub = (mamaSubscription) closure;
+ mamaSubscription_setPossiblyStale (sub);
+}
+
+static void
setStaleListenerIterator (wList list, void* element, void* closure)
{
SubscriptionInfo* subsc = (SubscriptionInfo*)element;
if (mamaSubscription_isTportDisconnected (subsc->mSubscription))
- mamaSubscription_setPossiblyStale (subsc->mSubscription);
+ {
+ mamaQueue queue = NULL;
+ mamaSubscription_getQueue (subsc->mSubscription, &queue);
+ mamaQueue_enqueueEvent (queue, (mamaQueueEventCB)staleEventCallback, subsc->mSubscription);
+ }
}
static void
--
1.7.9.5