From c798ccaa3ee71ac285bd275cf3f047f846064aa6 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Wed, 5 Sep 2012 09:34:19 +0200 Subject: [PATCH] request resubscription threading issue fix --- pvAccessApp/remoteClient/clientContextImpl.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pvAccessApp/remoteClient/clientContextImpl.cpp b/pvAccessApp/remoteClient/clientContextImpl.cpp index 3e3e017..4897b06 100644 --- a/pvAccessApp/remoteClient/clientContextImpl.cpp +++ b/pvAccessApp/remoteClient/clientContextImpl.cpp @@ -126,6 +126,8 @@ namespace epics { bool m_destroyed; bool m_initialized; + AtomicBoolean m_subscribed; + virtual ~BaseRequestImpl() {}; BaseRequestImpl(ChannelImpl::shared_pointer const & channel, Requester::shared_pointer const & requester) : @@ -134,7 +136,8 @@ namespace epics { m_ioid(INVALID_IOID), m_pendingRequest(NULL_REQUEST), m_destroyed(false), - m_initialized(false) + m_initialized(false), + m_subscribed() { } @@ -277,13 +280,19 @@ namespace epics { if (&status == &ChannelImpl::channelDestroyed) destroy(); else if (&status == &ChannelImpl::channelDisconnected) + { + m_subscribed.clear(); stopRequest(); + } // TODO notify? } virtual void resubscribeSubscription(Transport::shared_pointer const & transport) { - if (transport.get() != 0 && startRequest(QOS_INIT)) + if (transport.get() != 0 && !m_subscribed.get() && startRequest(QOS_INIT)) + { + m_subscribed.set(); transport->enqueueSendRequest(shared_from_this()); + } } virtual void updateSubscription() {