From e80ab0464e7c8393d98e57972e2c6919640c24ef Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 May 2017 15:02:25 -0400 Subject: [PATCH] less hacky-ness in operation disconnect/destroy notification avoid pointer/reference comparison. --- src/remote/pv/remote.h | 2 +- src/remoteClient/clientContextImpl.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/remote/pv/remote.h b/src/remote/pv/remote.h index 8ea7b4d..94dd1fa 100644 --- a/src/remote/pv/remote.h +++ b/src/remote/pv/remote.h @@ -566,7 +566,7 @@ public: * Report status to clients (e.g. disconnected). * @param status to report. */ - virtual void reportStatus(epics::pvData::Status const & status) = 0; + virtual void reportStatus(Channel::ConnectionState status) = 0; /** * Get request requester. diff --git a/src/remoteClient/clientContextImpl.cpp b/src/remoteClient/clientContextImpl.cpp index 98087a0..5e5661a 100644 --- a/src/remoteClient/clientContextImpl.cpp +++ b/src/remoteClient/clientContextImpl.cpp @@ -342,12 +342,11 @@ public: // TODO notify? } - void reportStatus(const Status& status) { + void reportStatus(Channel::ConnectionState status) { // destroy, since channel (parent) was destroyed - // NOTE: by-ref compare, not nice - if (&status == &ChannelImpl::channelDestroyed) + if (status == Channel::DESTROYED) destroy(); - else if (&status == &ChannelImpl::channelDisconnected) + else if (status == Channel::DISCONNECTED) { m_subscribed.clear(); stopRequest(); @@ -2000,9 +1999,9 @@ public: cancel(); } - void reportStatus(const Status& status) { + void reportStatus(Channel::ConnectionState status) { // destroy, since channel (parent) was destroyed - if (&status == &ChannelImpl::channelDestroyed) + if (status == Channel::DESTROYED) destroy(); // TODO notify? } @@ -4105,7 +4104,7 @@ private: */ void disconnectPendingIO(bool destroy) { - Status& status = destroy ? channelDestroyed : channelDisconnected; + Channel::ConnectionState state = destroy ? Channel::DESTROYED : Channel::DISCONNECTED; Lock guard(m_responseRequestsMutex); @@ -4125,7 +4124,7 @@ private: { if((ptr = rrs[i].lock())) { - EXCEPTION_GUARD(ptr->reportStatus(status)); + EXCEPTION_GUARD(ptr->reportStatus(state)); } } }