From 92ffe1d7267970ac392d770a071c858dc671a14f Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 18 Oct 2016 11:39:38 +0200 Subject: [PATCH] cas: fix first subscription update returning only 1 element when 0 were requested --- src/cas/generic/caServerI.h | 9 +++++++-- src/cas/generic/casStrmClient.cc | 25 +++++++++++++++++-------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/cas/generic/caServerI.h b/src/cas/generic/caServerI.h index 6037d8c20..b45d9373a 100644 --- a/src/cas/generic/caServerI.h +++ b/src/cas/generic/caServerI.h @@ -40,8 +40,13 @@ class casIntfOS; class casMonitor; class casChannelI; -caStatus convertContainerMemberToAtomic ( class gdd & dd, - aitUint32 appType, aitUint32 elemCount ); +caStatus convertContainerMemberToAtomic (class gdd & dd, + aitUint32 appType, aitUint32 requestedCount, aitUint32 nativeCount); + +// Keep the old signature for backward compatibility +inline caStatus convertContainerMemberToAtomic (class gdd & dd, + aitUint32 appType, aitUint32 elemCount) +{ return convertContainerMemberToAtomic(dd, appType, elemCount, elemCount); } class caServerI : public caServerIO, diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index b1e321120..d8d36d926 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -737,7 +737,9 @@ caStatus casStrmClient::readNotifyFailureResponse ( // than the destination) // caStatus convertContainerMemberToAtomic ( gdd & dd, - aitUint32 appType, aitUint32 elemCount ) + aitUint32 appType, + aitUint32 requestedCount, + aitUint32 nativeCount ) { gdd * pVal; if ( dd.isContainer() ) { @@ -764,13 +766,13 @@ caStatus convertContainerMemberToAtomic ( gdd & dd, return S_cas_badType; } - if ( elemCount <= 1 ) { + if ( nativeCount <= 1 ) { return S_cas_success; } // convert to atomic gddBounds bds; - bds.setSize ( elemCount ); + bds.setSize ( requestedCount ); bds.setFirst ( 0u ); pVal->setDimension ( 1u, & bds ); return S_cas_success; @@ -780,7 +782,9 @@ caStatus convertContainerMemberToAtomic ( gdd & dd, // createDBRDD () // static caStatus createDBRDD ( unsigned dbrType, - unsigned elemCount, gdd * & pDD ) + unsigned requestedCount, + unsigned nativeCount, + gdd * & pDD ) { /* * DBR type has already been checked, but it is possible @@ -808,7 +812,7 @@ static caStatus createDBRDD ( unsigned dbrType, // fix the value element count caStatus status = convertContainerMemberToAtomic ( - *pDescRet, gddAppType_value, elemCount ); + *pDescRet, gddAppType_value, requestedCount, nativeCount ); if ( status != S_cas_success ) { pDescRet->unreference (); return status; @@ -884,7 +888,10 @@ caStatus casStrmClient::monitorResponse ( gdd * pDBRDD = 0; if ( completionStatus == S_cas_success ) { - caStatus status = createDBRDD ( msg.m_dataType, count, pDBRDD ); + caStatus status = createDBRDD ( msg.m_dataType, + count, + chan.getPVI().nativeCount(), + pDBRDD ); if ( status != S_cas_success ) { caStatus ecaStatus; if ( status == S_cas_badType ) { @@ -2614,8 +2621,10 @@ caStatus casStrmClient::read () { gdd * pDD = 0; - caStatus status = createDBRDD ( pHdr->m_dataType, - pHdr->m_count, pDD ); + caStatus status = createDBRDD ( pHdr->m_dataType, + pHdr->m_count, + this->ctx.getChannel()->getPVI().nativeCount(), + pDD ); if ( status != S_cas_success ) { return status; }