"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "iogateway/TemplatingMessageIOGateway.cpp" between
muscle8.20.zip and muscle8.30.zip

About: MUSCLE (Multi User Server Client Linking Environment) is a messaging server and networking API. The included server program ("muscled") lets its clients message each other, and/or store information in its serverside hierarchical database.

TemplatingMessageIOGateway.cpp  (muscle8.20):TemplatingMessageIOGateway.cpp  (muscle8.30)
skipping to change at line 17 skipping to change at line 17
TemplatingMessageIOGateway :: TemplatingMessageIOGateway(uint32 maxLRUCacheSizeB ytes, int32 outgoingEncoding) TemplatingMessageIOGateway :: TemplatingMessageIOGateway(uint32 maxLRUCacheSizeB ytes, int32 outgoingEncoding)
: CountedMessageIOGateway(outgoingEncoding) : CountedMessageIOGateway(outgoingEncoding)
, _maxLRUCacheSizeBytes(maxLRUCacheSizeBytes) , _maxLRUCacheSizeBytes(maxLRUCacheSizeBytes)
, _incomingTemplatesTotalSizeBytes(0) , _incomingTemplatesTotalSizeBytes(0)
, _outgoingTemplatesTotalSizeBytes(0) , _outgoingTemplatesTotalSizeBytes(0)
{ {
// empty // empty
} }
static const uint32 CREATE_TEMPLATE_BIT = (1<<31); // if the high-bit is set i static const uint32 CREATE_TEMPLATE_BIT = (((uint32)1)<<31); // if the high-bi
n the length-word, that means the receiver should use the buffer's Message to cr t is set in the length-word, that means the receiver should use the buffer's Mes
eate a template sage to create a template
static const uint32 PAYLOAD_ENCODING_BIT = (1<<31); // if the high-bit is set i static const uint32 PAYLOAD_ENCODING_BIT = (((uint32)1)<<31); // if the high-bi
n the encoding-word, that means the receiver should interpret the buffer as payl t is set in the encoding-word, that means the receiver should interpret the buff
oad-only and not as a flattened Message er as payload-only and not as a flattened Message
int32 TemplatingMessageIOGateway :: GetBodySize(const uint8 * headerBuf) const int32 TemplatingMessageIOGateway :: GetBodySize(const uint8 * headerBuf) const
{ {
const uint32 bodySize = B_LENDIAN_TO_HOST_INT32(muscleCopyIn<uint32>(&headerB uf[0*sizeof(uint32)])) & ~CREATE_TEMPLATE_BIT; const uint32 bodySize = B_LENDIAN_TO_HOST_INT32(muscleCopyIn<uint32>(&headerB uf[0*sizeof(uint32)])) & ~CREATE_TEMPLATE_BIT;
const uint32 encoding = B_LENDIAN_TO_HOST_INT32(muscleCopyIn<uint32>(&headerB uf[1*sizeof(uint32)])) & ~PAYLOAD_ENCODING_BIT; const uint32 encoding = B_LENDIAN_TO_HOST_INT32(muscleCopyIn<uint32>(&headerB uf[1*sizeof(uint32)])) & ~PAYLOAD_ENCODING_BIT;
return muscleInRange(encoding, (uint32)MUSCLE_MESSAGE_ENCODING_DEFAULT, (uint 32)(MUSCLE_MESSAGE_ENCODING_END_MARKER-1)) ? (int32)bodySize : (int32)-1; return muscleInRange(encoding, (uint32)MUSCLE_MESSAGE_ENCODING_DEFAULT, (uint 32)(MUSCLE_MESSAGE_ENCODING_END_MARKER-1)) ? (int32)bodySize : (int32)-1;
} }
ByteBufferRef TemplatingMessageIOGateway :: FlattenHeaderAndMessage(const Messag eRef & msgRef) const ByteBufferRef TemplatingMessageIOGateway :: FlattenHeaderAndMessage(const Messag eRef & msgRef) const
{ {
skipping to change at line 234 skipping to change at line 234
void TemplatingMessageIOGateway :: Reset() void TemplatingMessageIOGateway :: Reset()
{ {
CountedMessageIOGateway::Reset(); CountedMessageIOGateway::Reset();
_incomingTemplates.Clear(); _incomingTemplates.Clear();
_outgoingTemplates.Clear(); _outgoingTemplates.Clear();
_incomingTemplatesTotalSizeBytes = _outgoingTemplatesTotalSizeBytes = 0; _incomingTemplatesTotalSizeBytes = _outgoingTemplatesTotalSizeBytes = 0;
} }
void TemplatingMessageIOGateway :: TrimLRUCache(Hashtable<uint64, MessageRef> & lruCache, uint32 & tallyBytes, const char * desc) const void TemplatingMessageIOGateway :: TrimLRUCache(Hashtable<uint64, MessageRef> & lruCache, uint32 & tallyBytes, const char * desc) const
{ {
while((lruCache.GetNumItems()>1)&(tallyBytes > _maxLRUCacheSizeBytes)) while((lruCache.GetNumItems()>1)&&(tallyBytes > _maxLRUCacheSizeBytes))
{ {
const uint32 lastSize = lruCache.GetLastValue()->GetItemPointer()->Flatten edSize(); const uint32 lastSize = lruCache.GetLastValue()->GetItemPointer()->Flatten edSize();
(void) lruCache.RemoveLast(); (void) lruCache.RemoveLast();
if (tallyBytes >= lastSize) tallyBytes -= lastSize; if (tallyBytes >= lastSize) tallyBytes -= lastSize;
else else
{ {
LogTime(MUSCLE_LOG_ERROR, "TrimLRUCache(): tallyBytes is too small! " UINT32_FORMAT_SPEC "/" UINT32_FORMAT_SPEC "/" UINT32_FORMAT_SPEC "\n", tallyByt es, lastSize, lruCache.GetNumItems()); LogTime(MUSCLE_LOG_ERROR, "TrimLRUCache(): tallyBytes is too small! " UINT32_FORMAT_SPEC "/" UINT32_FORMAT_SPEC "/" UINT32_FORMAT_SPEC "\n", tallyByt es, lastSize, lruCache.GetNumItems());
tallyBytes = 0; // I guess? tallyBytes = 0; // I guess?
} }
 End of changes. 2 change blocks. 
7 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)