From 2af392a099ed49b8a8d776f516137d5838c97eb9 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 12 Jan 2011 15:41:33 -0700 Subject: [PATCH 1/2] fix for bug 701673 at launchpad (wrong native element count for large arrays) --- src/rsrv/caserverio.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/rsrv/caserverio.c b/src/rsrv/caserverio.c index 119ad5e3a..466e492f0 100644 --- a/src/rsrv/caserverio.c +++ b/src/rsrv/caserverio.c @@ -33,10 +33,6 @@ #define epicsExportSharedSymbols #include "server.h" -/* As an optimisation, any message allocated with a large header is resized to - * use a small header if the payload size is below this threshold. */ -#define SMALL_MESSAGE_THRESHOLD 65 - /* * cas_send_bs_msg() * @@ -357,19 +353,8 @@ void cas_commit_msg ( struct client *pClient, ca_uint32_t size ) if ( pMsg->m_postsize == htons ( 0xffff ) ) { ca_uint32_t * pLW = ( ca_uint32_t * ) ( pMsg + 1 ); assert ( size <= ntohl ( *pLW ) ); - if (size < SMALL_MESSAGE_THRESHOLD) { - /* If the message is sufficiently small it can be worth converting a - * large message header into a small header. This saves us all of 8 - * bytes over the wire, so it's not such a big deal. */ - pMsg->m_postsize = htons((ca_uint16_t) size); - pMsg->m_count = htons((ca_uint16_t) ntohl(pLW[1])); - memmove(pLW, pLW + 2, size); - size += sizeof(caHdr); - } - else { - pLW[0] = htonl ( size ); - size += sizeof ( caHdr ) + 2 * sizeof ( *pLW ); - } + pLW[0] = htonl ( size ); + size += sizeof ( caHdr ) + 2 * sizeof ( *pLW ); } else { assert ( size <= ntohs ( pMsg->m_postsize ) ); From a2c87268f54028121bd895ed38df0be5063a3781 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 14 Jan 2011 17:53:33 -0700 Subject: [PATCH 2/2] in disconnectAllChannels mark channels as unassigned to any list because in some unusual situations (abrupt shutdown) the channels are not immediately assigned to another list --- src/ca/tcpiiu.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index a38ee7ff3..9cf9f6f4d 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -1866,10 +1866,14 @@ void tcpiiu::unlinkAllChannels ( guard.assertIdenticalMutex ( this->mutex ); while ( nciu * pChan = this->createReqPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->createRespPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; // we dont yet know the server's id so we cant // send a channel delete request and will instead // trust that the server can do the proper cleanup @@ -1878,12 +1882,16 @@ void tcpiiu::unlinkAllChannels ( } while ( nciu * pChan = this->v42ConnCallbackPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->subscripReqPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); @@ -1891,6 +1899,8 @@ void tcpiiu::unlinkAllChannels ( } while ( nciu * pChan = this->connectedList.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); @@ -1898,6 +1908,8 @@ void tcpiiu::unlinkAllChannels ( } while ( nciu * pChan = this->unrespCircuit.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); // if we know that the circuit is unresponsive // then we dont send a channel delete request and @@ -1907,6 +1919,8 @@ void tcpiiu::unlinkAllChannels ( } while ( nciu * pChan = this->subscripUpdateReqPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) );