From 5199742bce114973ff11ae1a5da2f172a04b4c94 Mon Sep 17 00:00:00 2001 From: mrkraimer Date: Sat, 5 Aug 2017 07:34:21 -0400 Subject: [PATCH] always call getConnect, putConnect, monitorConnect when reconnecting --- src/ca/caChannel.cpp | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/ca/caChannel.cpp b/src/ca/caChannel.cpp index 9e3c248..75d020b 100644 --- a/src/ca/caChannel.cpp +++ b/src/ca/caChannel.cpp @@ -681,9 +681,13 @@ void CAChannelGet::channelCreated(const Status& status,Channel::shared_pointer c { chtype newType = getDBRType(pvRequest, channel->getNativeType()); if(newType!=getType) { - pvStructure.reset(); - activate(); + getType = getDBRType(pvRequest, channel->getNativeType()); + pvStructure = createPVStructure(channel, getType, pvRequest); + bitSet = BitSetPtr(new BitSet(pvStructure->getStructure()->getNumberFields())); + bitSet->set(0); } + EXCEPTION_GUARD(channelGetRequester->channelGetConnect(Status::Ok, shared_from_this(), + pvStructure->getStructure())); } void CAChannelGet::channelStateChange( @@ -1175,7 +1179,6 @@ void CAChannelPut::activate() getType = getDBRType(pvRequest,channel->getNativeType()); pvStructure = createPVStructure(channel, getType, pvRequest); bitSet = BitSetPtr(new BitSet(pvStructure->getStructure()->getNumberFields())); - // NOTE: we require value type, we can only put value field PVStringPtr pvString = pvRequest->getSubField("record._options.block"); if(pvString) { std::string val = pvString->get(); @@ -1192,9 +1195,18 @@ void CAChannelPut::channelCreated(const Status& status,Channel::shared_pointer c { chtype newType = getDBRType(pvRequest, channel->getNativeType()); if(newType!=getType) { - pvStructure.reset(); - activate(); + getType = getDBRType(pvRequest, channel->getNativeType()); + pvStructure = createPVStructure(channel, getType, pvRequest); + bitSet = BitSetPtr(new BitSet(pvStructure->getStructure()->getNumberFields())); + PVStringPtr pvString = pvRequest->getSubField("record._options.block"); + if(pvString) { + std::string val = pvString->get(); + if(val.compare("true")==0) block = true; + } + bitSet->set(0); } + EXCEPTION_GUARD(channelPutRequester->channelPutConnect(Status::Ok, shared_from_this(), + pvStructure->getStructure())); } void CAChannelPut::channelStateChange( @@ -1676,9 +1688,24 @@ void CAChannelMonitor::channelCreated(const Status& status,Channel::shared_point { chtype newType = getDBRType(pvRequest, channel->getNativeType()); if(newType!=getType) { - pvStructure.reset(); - activate(); + getType = getDBRType(pvRequest, channel->getNativeType()); + pvStructure = createPVStructure(channel, getType, pvRequest); + int32 queueSize = 2; + PVStructurePtr pvOptions = pvRequest->getSubField("record._options"); + if (pvOptions) { + PVStringPtr pvString = pvOptions->getSubField("queueSize"); + if (pvString) { + int size; + std::stringstream ss; + ss << pvString->get(); + ss >> size; + if (size > 1) queueSize = size; + } + } + monitorQueue = CACMonitorQueuePtr(new CACMonitorQueue(queueSize)); } + EXCEPTION_GUARD(monitorRequester->monitorConnect(Status::Ok, shared_from_this(), + pvStructure->getStructure())); } void CAChannelMonitor::channelStateChange(