diff --git a/src/cas/generic/casChannelI.cc b/src/cas/generic/casChannelI.cc index 588f67d78..376f62f8c 100644 --- a/src/cas/generic/casChannelI.cc +++ b/src/cas/generic/casChannelI.cc @@ -21,6 +21,7 @@ casChannelI::casChannelI ( casCoreClient & clientIn, casChannel & chanIn, casPVI & pvIn, ca_uint32_t cidIn ) : privateForPV ( clientIn, *this ), pv ( pvIn ), + maxElem( pvIn.nativeCount() ), chan ( chanIn ), cid ( cidIn ), serverDeletePending ( false ), @@ -29,7 +30,7 @@ casChannelI::casChannelI ( casCoreClient & clientIn, } casChannelI::~casChannelI () -{ +{ this->privateForPV.client().removeFromEventQueue ( *this, this->accessRightsEvPending ); @@ -48,7 +49,7 @@ void casChannelI::uninstallFromPV ( casEventSys & eventSys ) this->privateForPV.removeSelfFromPV ( this->pv, dest ); while ( casMonitor * pMon = dest.get () ) { eventSys.prepareMonitorForDestroy ( *pMon ); - } + } } void casChannelI::show ( unsigned level ) const @@ -68,13 +69,13 @@ caStatus casChannelI::cbFunc ( { caStatus stat = S_cas_success; { - stat = this->privateForPV.client().accessRightsResponse ( + stat = this->privateForPV.client().accessRightsResponse ( clientGuard, this ); } - if ( stat == S_cas_success ) { - this->accessRightsEvPending = false; - } - return stat; + if ( stat == S_cas_success ) { + this->accessRightsEvPending = false; + } + return stat; } caStatus casChannelI::read ( const casCtx & ctx, gdd & prototype ) diff --git a/src/cas/generic/casChannelI.h b/src/cas/generic/casChannelI.h index 2c72e88e4..a0f74a1df 100644 --- a/src/cas/generic/casChannelI.h +++ b/src/cas/generic/casChannelI.h @@ -1,4 +1,3 @@ - /*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. @@ -31,55 +30,62 @@ class casChannelI : public tsDLNode < casChannelI >, public: casChannelI ( casCoreClient & clientIn, casChannel & chanIn, casPVI & pvIn, ca_uint32_t cidIn ); - ~casChannelI (); + ~casChannelI (); void casChannelDestroyFromInterfaceNotify (); - const caResId getCID (); - const caResId getSID (); + const caResId getCID (); + const caResId getSID (); void uninstallFromPV ( casEventSys & eventSys ); void installIntoPV (); void installIO ( casAsyncIOI & ); void uninstallIO ( casAsyncIOI & ); void installMonitor ( casMonitor & mon ); casMonitor * removeMonitor ( ca_uint32_t clientIdIn ); - casPVI & getPVI () const; - void clearOutstandingReads (); - void postAccessRightsEvent (); + casPVI & getPVI () const; + void clearOutstandingReads (); + void postAccessRightsEvent (); const gddEnumStringTable & enumStringTable () const; - void setOwner ( const char * const pUserName, - const char * const pHostName ); - bool readAccess () const; + ca_uint32_t getMaxElem () const; + void setOwner ( const char * const pUserName, + const char * const pHostName ); + bool readAccess () const; bool writeAccess () const; - bool confirmationRequested () const; + bool confirmationRequested () const; caStatus read ( const casCtx & ctx, gdd & prototype ); caStatus write ( const casCtx & ctx, const gdd & value ); caStatus writeNotify ( const casCtx & ctx, const gdd & value ); - void show ( unsigned level ) const; + void show ( unsigned level ) const; private: chanIntfForPV privateForPV; - tsDLList < casAsyncIOI > ioList; - casPVI & pv; + tsDLList < casAsyncIOI > ioList; + casPVI & pv; + ca_uint32_t maxElem; casChannel & chan; - caResId cid; // client id + caResId cid; // client id bool serverDeletePending; - bool accessRightsEvPending; - //epicsShareFunc virtual void destroy (); - caStatus cbFunc ( + bool accessRightsEvPending; + //epicsShareFunc virtual void destroy (); + caStatus cbFunc ( casCoreClient &, epicsGuard < casClientMutex > &, epicsGuard < evSysMutex > & ); void postDestroyEvent (); - casChannelI ( const casChannelI & ); - casChannelI & operator = ( const casChannelI & ); + casChannelI ( const casChannelI & ); + casChannelI & operator = ( const casChannelI & ); }; inline casPVI & casChannelI::getPVI () const { - return this->pv; + return this->pv; +} + +inline ca_uint32_t casChannelI::getMaxElem () const +{ + return this->maxElem; } inline const caResId casChannelI::getCID () { - return this->cid; + return this->cid; } inline const caResId casChannelI::getSID () @@ -89,7 +95,7 @@ inline const caResId casChannelI::getSID () inline void casChannelI::postAccessRightsEvent () { - this->privateForPV.client().addToEventQueue ( *this, this->accessRightsEvPending ); + this->privateForPV.client().addToEventQueue ( *this, this->accessRightsEvPending ); } inline const gddEnumStringTable & casChannelI::enumStringTable () const @@ -108,7 +114,7 @@ inline void casChannelI::clearOutstandingReads () } inline void casChannelI::setOwner ( const char * const pUserName, - const char * const pHostName ) + const char * const pHostName ) { this->chan.setOwner ( pUserName, pHostName ); } diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index e23a2b8df..60903787c 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -409,7 +409,7 @@ caStatus casStrmClient::verifyRequest (casChannelI * & pChan , bool allowdyn) // // element count out of range ? // - if ( ctx.msg.m_count > pChan->getPVI().nativeCount() || + if ( ctx.msg.m_count > pChan->getMaxElem() || ( !allowdyn && ctx.msg.m_count == 0u ) ) { return ECA_BADCOUNT; } @@ -895,7 +895,7 @@ caStatus casStrmClient::monitorResponse ( gdd * pDBRDD = 0; if ( completionStatus == S_cas_success ) { caStatus status = createDBRDD ( msg.m_dataType, count, - chan.getPVI().nativeCount(), pDBRDD ); + chan.getMaxElem(), pDBRDD ); if ( status != S_cas_success ) { caStatus ecaStatus; if ( status == S_cas_badType ) { @@ -1866,7 +1866,7 @@ caStatus casStrmClient::privateCreateChanResponse ( // the protocol buffer. // assert ( nativeTypeDBR <= 0xffff ); - aitIndex nativeCount = chan.getPVI().nativeCount(); + aitIndex nativeCount = chan.getMaxElem(); assert ( nativeCount <= 0xffffffff ); assert ( hdr.m_cid == chan.getCID() ); status = this->out.copyInHeader ( CA_PROTO_CREATE_CHAN, 0, @@ -2626,7 +2626,7 @@ caStatus casStrmClient::read () { gdd * pDD = 0; caStatus status = createDBRDD ( pHdr->m_dataType, pHdr->m_count, - this->ctx.getChannel()->getPVI().nativeCount(), pDD ); + this->ctx.getChannel()->getMaxElem(), pDD ); if ( status != S_cas_success ) { return status; }