Skip to content

Commit

Permalink
v7.03 release
Browse files Browse the repository at this point in the history
  • Loading branch information
jfriesne committed Sep 28, 2018
1 parent 0fe7118 commit d6a3e25
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 24 deletions.
5 changes: 5 additions & 0 deletions BUILDOPTIONS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ of your Makefile to alter muscle's behaviour:
classes if you are compiling using C++11 but nevertheless you still
want those classes to use OS-specific back-end APIs instead.

-DMUSCLE_AVOID_CPLUSPLUS11_BITCHORD
Set this to avoid the C++11 implementation of the BitChord class and
fall back to the legacy/C++03 implementation instead. (Useful for
old/broken C++11 compilers that don't quite grok the C++11 implementation)

-DMUSCLE_AVOID_CPLUSPLUS11_THREAD_LOCAL_KEYWORD
Tells the ThreadLocalStorage class to avoid using the C++11 thread_local
keyword even through C++11 support is enabled. Defined automatically for
Expand Down
15 changes: 15 additions & 0 deletions HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ key: - new feature
* bug fixed
o other

7.03 Released 9/28/2018
- WarnOutOfMemory() now calls PrintStackTrace() (but not more
often than once every 5 seconds, to avoid spamming)
- BitChord::ClearUnusedBits() is now O(1) when compiled with C++11.
o support/BitChord.h will now fall back to its legacy implementation
if MUSCLE_AVOID_CPLUSPLUS11_BITCHORD is defined. (This define
will automatically be set if MUSCLE_AVOID_CPLUSPLUS11 is defined)
o Removed unnecessary call to ERR_print_errors_fp() from the
SSLSocketDataIO constructor.
* IPAddress's string-argument-constructor left its fields
uninitialized in the case where SetFromString() failed. Fixed.
* Fixed a bug in StorageRectSession::DoTraversalAux() that would
cause the node-traversal to skip first node-name specified in
the second (and later) path-strings in a Message.

7.02 Released 9/7/2018
- Added a function OptimizeMessageForTransmissionToMultipleGateways()
that can be used to greatly reduce a server's RAM usage when it is
Expand Down
4 changes: 2 additions & 2 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<H2>
MUSCLE: Crossbar Server, Portable Messaging and Support Classes<p>
9/7/2018 v7.02 jaf@meyersound.com<p>
10/28/2018 v7.03 jaf@meyersound.com<p>
Jeremy Friesner / Meyer Sound Laboratories Inc.<p>
Win32 compatibility contributions by Vitaliy Mikitchenko<p>
C# client code by Wilson Yeung<p>
Expand Down Expand Up @@ -36,7 +36,7 @@ <H2>
<ol>
<li>SUSE, Debian, and Ubuntu Linux on various 32-bit and 64-bit PCs</li>
<li>MacOS/X on various PowerPC and Intel based Macs</li>
<li>Microsoft Windows XP and Windows 7 using Visual Studio 2008 or higher (use the projects files in the 'vc++' subfolder)</li>
<li>Microsoft Windows XP, Windows 7 and Windows 10 using Visual Studio 2008 or newer (use the projects files in the 'vc++' subfolder)</li>
</ol>
<p>
It has no known bugs, but may have some yet-to-be-discovered ones.
Expand Down
2 changes: 0 additions & 2 deletions dataio/SSLSocketDataIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ SSLSocketDataIO :: SSLSocketDataIO(const ConstSocketRef & sockfd, bool blocking,
if (accept) SSL_set_accept_state(CAST_SSL);
else SSL_set_connect_state(CAST_SSL);

ERR_print_errors_fp(stderr);

ok = true;
}
else LogTime(MUSCLE_LOG_ERROR, "SSLSocketDataIO: BIO_new_socket() failed!\n");
Expand Down
2 changes: 1 addition & 1 deletion html/Beginners Guide.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<HTML>
<HEAD>
<H1>MUSCLE Overview and Beginner's Guide</H1>
<H4>v7.02 / Jeremy Friesner / Meyer Sound Laboratories Inc (jaf@meyersound.com) 9/7/2018</H4>
<H4>v7.03 / Jeremy Friesner / Meyer Sound Laboratories Inc (jaf@meyersound.com) 9/28/2018</H4>
<A HREF="http://www.lcscanada.com/muscle/html/index.html">Click here for DOxygen class API documentation</A>
</HEAD>

Expand Down
2 changes: 1 addition & 1 deletion html/Custom Servers.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<HTML>
<HEAD>
<H1>Implementing a Custom Server with MUSCLE</H1>
<H4>v7.02 / Jeremy Friesner / Meyer Sound Laboratories Inc / jaf@meyersound.com 9/7/2018</H4>
<H4>v7.03 / Jeremy Friesner / Meyer Sound Laboratories Inc / jaf@meyersound.com 9/28/2018</H4>
</HEAD>
<BODY bgcolor=#ffffff>
<H2>Introduction</H2>
Expand Down
2 changes: 1 addition & 1 deletion micromessage/MicroMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ typedef struct _UMessageFieldNameIterator {
} UMessageFieldNameIterator;
#endif

/** Initializes the state of the specified UMessageFieldNameIterato to point at the specified UMessage.
/** Initializes the state of the specified UMessageFieldNameIterator to point at the specified UMessage.
* When this function returns, the iterator will be pointing to the first matching field in the UMessage (if there are any).
* @param iter The iterator object to initialize.
* @param msg The UMessage object the iterator is to examine. (This object must remain valid while the iterator is in use)
Expand Down
6 changes: 4 additions & 2 deletions reflector/StorageReflectSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,8 @@ DoTraversalAux(TraversalContext & data, DataNode & node)
int32 entryIdx = 0;
for (HashtableIterator<String, PathMatcherEntry> iter(GetEntries()); iter.HasData(); iter++)
{
scratchStr.Clear(); // otherwise we might get leftover data from the previous PathMatcherEntry in the iteration

const StringMatcherQueue * nextQueue = iter.GetValue().GetParser()();
if ((nextQueue)&&((int)nextQueue->GetStringMatchers().GetNumItems() > depth-data.GetRootDepth()))
{
Expand All @@ -1432,8 +1434,8 @@ DoTraversalAux(TraversalContext & data, DataNode & node)
const char * k = key();
while(*k)
{
char c = *k;
bool curCharIsEscape = ((c == '\\')&&(prevCharWasEscape == false));
const char c = *k;
const bool curCharIsEscape = ((c == '\\')&&(prevCharWasEscape == false));
if (curCharIsEscape == false)
{
if ((prevCharWasEscape)||(c != ',')) scratchStr += c;
Expand Down
4 changes: 2 additions & 2 deletions reflector/StorageReflectSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ class StorageReflectSession : public DumbReflectSession
/**
* Recursively creates or updates a subtree of the node database from the given Message object.
* (It's a bit more efficient than it looks, since all data Messages are reference counted rather than copied)
* @param msg the Message to restore the subtree into. This Message is typically one that was created earlier by SaveNodeTreeToMessage().
* @param path The relative path of the root node, e.g. "" is your home session node.
* @param msg the Message to restore the subtree from. This Message is typically one that was created earlier by SaveNodeTreeToMessage().
* @param path The relative path of the root node to add restored nodes into, e.g. "" is your home session node.
* @param loadData Whether or not the payload Message of (node) should be restored. The payload Messages of (node)'s children will always be restored no matter what.
* @param appendToIndex Used in the recursion to handle restoring indexed nodes. You will usually want to Leave it as false when you call this method.
* @param maxDepth How many levels of children should be restored from the Message. If left as MUSCLE_NO_LIMIT (the default),
Expand Down
29 changes: 23 additions & 6 deletions support/BitChord.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

namespace muscle {

#if defined(MUSCLE_AVOID_CPLUSPLUS11) && !defined (MUSCLE_AVOID_CPLUSPLUS11_BITCHORD)
# define MUSCLE_AVOID_CPLUSPLUS11_BITCHORD
#endif

/** A templated class for implement an N-bit-long bit-chord. Useful for doing efficient parallel boolean operations
* on bits-strings of lengths that can't fit in any of the standard integer types, and also for holding bit-shifted
* boolean flags in a "safe" container so that you can query or manipulate the flags via human-readable method-calls
Expand All @@ -26,7 +30,7 @@ template <uint32 NumBits, class TagClass=Void> class BitChord : public PseudoFla
/** Default constructor */
BitChord() {ClearAllBits();}

#ifndef MUSCLE_AVOID_CPLUSPLUS11
#ifndef MUSCLE_AVOID_CPLUSPLUS11_BITCHORD
/** Variadic constructor; takes a list of bit-indices indicating which bits should be set in this BitChord.
* @param bits any number of bit-index arguments may be supplied, and the correspond bits will be set.
* @note for example, BitChord bc(a, b, c); is equivalent to BitChord bc; bc.SetBit(a); bc.SetBit(b); bc.SetBit(c);
Expand Down Expand Up @@ -225,7 +229,7 @@ template <uint32 NumBits, class TagClass=Void> class BitChord : public PseudoFla
/** @copydoc DoxyTemplate::HashCode() const */
uint32 HashCode() const {return CalculateChecksum();}

#ifndef MUSCLE_AVOID_CPLUSPLUS11
#ifndef MUSCLE_AVOID_CPLUSPLUS11_BITCHORD
/** Equivalent to calling SetBit() multiple times; once per supplied argument.
* e.g. calling SetBits(a,b,c) is equivalent to calling SetBit(a);SetBit(b);SetBit(c).
* @param bits a list of bit-indices indicating which bit(s) to set
Expand Down Expand Up @@ -494,9 +498,14 @@ template <uint32 NumBits, class TagClass=Void> class BitChord : public PseudoFla
}

private:
#ifdef MUSCLE_AVOID_CPLUSPLUS11
#ifdef MUSCLE_AVOID_CPLUSPLUS11_BITCHORD
int OneIffBitIsSet( uint32 whichBit) const {return IsBitSet(whichBit)?1:0;}
int OneIffBitIsUnset(uint32 whichBit) const {return IsBitSet(whichBit)?0:1;}
#else
static constexpr uint32 GetWordWithFirstNBitsSet(int numBits)
{
return (numBits <= 0) ? ((uint32)0) : ((((uint32)1)<<(numBits-1)) | GetWordWithFirstNBitsSet(numBits-1));
}
#endif

bool IsBitSetUnchecked(uint32 whichBit) const {return ((_words[whichBit/NUM_BITS_PER_WORD] & (1<<(whichBit%NUM_BITS_PER_WORD))) != 0);}
Expand All @@ -510,8 +519,16 @@ template <uint32 NumBits, class TagClass=Void> class BitChord : public PseudoFla

void ClearUnusedBits()
{
if (((NumBits%NUM_BITS_PER_WORD)!=0)&&(_words[NUM_WORDS-1] != 0))
for (uint32 i=NumBits; i<(NUM_WORDS*NUM_BITS_PER_WORD); i++) ClearBitUnchecked(i);
const uint32 numLeftoverBits = NumBits%NUM_BITS_PER_WORD;
if (numLeftoverBits > 0)
{
uint32 & lastWord = _words[NUM_WORDS-1];
#ifdef MUSCLE_AVOID_CPLUSPLUS11_BITCHORD
if (lastWord != 0) for (uint32 i=NumBits; i<(NUM_WORDS*NUM_BITS_PER_WORD); i++) ClearBitUnchecked(i);
#else
lastWord &= GetWordWithFirstNBitsSet(numLeftoverBits); // O(1) implementation
#endif
}
}

enum {NUM_BITS_PER_BYTE = 8};
Expand All @@ -525,7 +542,7 @@ template <uint32 NumBits, class TagClass=Void> class BitChord : public PseudoFla
public:
// This is the hacked-for-C++03 implementation of our variadic methods; it's here for backwards compatibility with old compilers only!
// It works the same as the above variadic implementation, but only for up to 32 arguments (and it's macro-based, so it's a total eyesore, sorry)
#ifdef MUSCLE_AVOID_CPLUSPLUS11
#ifdef MUSCLE_AVOID_CPLUSPLUS11_BITCHORD
# ifndef DOXYGEN_SHOULD_IGNORE_THIS

#define BC_ARGS_1 uint32 b1
Expand Down
4 changes: 2 additions & 2 deletions support/MuscleSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#ifndef MuscleSupport_h
#define MuscleSupport_h

#define MUSCLE_VERSION_STRING "7.02" /**< The current version of the MUSCLE distribution, expressed as an ASCII string */
#define MUSCLE_VERSION 70200 /**< Current version, expressed as decimal Mmmbb, where (M) is the number before the decimal point, (mm) is the number after the decimal point, and (bb) is reserved */
#define MUSCLE_VERSION_STRING "7.03" /**< The current version of the MUSCLE distribution, expressed as an ASCII string */
#define MUSCLE_VERSION 70300 /**< Current version, expressed as decimal Mmmbb, where (M) is the number before the decimal point, (mm) is the number after the decimal point, and (bb) is reserved */

/*! \mainpage MUSCLE Documentation Page
*
Expand Down
6 changes: 6 additions & 0 deletions syslog/SysLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,12 @@ void WarnOutOfMemory(const char * file, int line)
// for now.
NestCountGuard ncg(_inWarnOutOfMemory); // avoid potential infinite recursion if LogCallbacks called by LogTime() try to allocate more memory and also fail
LogTime(MUSCLE_LOG_CRITICALERROR, "ERROR--MEMORY ALLOCATION FAILURE! (" INT32_FORMAT_SPEC " bytes at %s:%i)\n", GetAndClearFailedMemoryRequestSize(), file, line);

if (_inWarnOutOfMemory.IsOutermost())
{
static uint64 _prevCallTime = 0;
if (OnceEvery(SecondsToMicros(5), _prevCallTime)) PrintStackTrace();
}
}

#endif
Expand Down
1 change: 0 additions & 1 deletion system/SetupSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,6 @@ void AbstractObjectRecycler :: GlobalFlushAllCachedObjects()
// been flushed.
AbstractObjectRecycler * r = _firstRecycler;
while(r) r = (r->FlushCachedObjects() > 0) ? _firstRecycler : r->_next;

if (m) m->Unlock();
}

Expand Down
1 change: 1 addition & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ DEFINES += -DMUSCLE_AVOID_SIGNAL_HANDLING
#DEFINES += -DMUSCLE_AVOID_CPLUSPLUS11
#DEFINES += -DMUSCLE_AVOID_CPLUSPLUS11_THREADS
#DEFINES += -DMUSCLE_AVOID_CPLUSPLUS11_THREAD_LOCAL_KEYWORD
#DEFINES += -DMUSCLE_AVOID_CPLUSPLUS11_BITCHORD
#DEFINES += -DMUSCLE_USE_PTHREADS
#DEFINES += -DMUSCLE_COUNT_STRING_COPY_OPERATIONS
#DEFINES += -DMUSCLE_NO_EXCEPTIONS
Expand Down
2 changes: 1 addition & 1 deletion test/testbitchord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ int main(void)
printf("X18 %i\n", val.AreAnyOfTheseBitsUnset(OPTION_E, OPTION_F, OPTION_G, OPTION_H));
printf("X19 [%s]\n", TestOptionBits::WithAllBitsSetExceptThese(OPTION_A, OPTION_C, OPTION_D).ToHexString()());

TestOptionBits fromWords = TestOptionBits::FromWords((uint32)1,(uint32)2);
TestOptionBits fromWords = TestOptionBits::FromWords((uint32)3,(uint32)0xFFFFFFF5);
printf("X20 [%s]\n", fromWords.ToHexString()());

TestOptionBits fromBytes = TestOptionBits::FromBytes((uint8)1,(uint8)2,(uint8)3,(uint8)4,(uint8)(0x65));
Expand Down
6 changes: 3 additions & 3 deletions util/IPAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class IPAddress MUSCLE_FINAL_CLASS : public PseudoFlattenable
* object and then calling SetFromString() on it with the given arguments.
* @param s an IPAddress to parse (e.g. "127.0.0.1" or "ff12::02@3")
*/
IPAddress(const String & s) {(void) SetFromString(s);}
IPAddress(const String & s) : _lowBits(0), _highBits(0), _interfaceIndex(0) {(void) SetFromString(s);}

/** @copydoc DoxyTemplate::DoxyTemplate(const DoxyTemplate &) */
IPAddress(const IPAddress & rhs) : _lowBits(rhs._lowBits), _highBits(rhs._highBits), _interfaceIndex(rhs._interfaceIndex) {/* empty */}
Expand All @@ -44,10 +44,10 @@ class IPAddress MUSCLE_FINAL_CLASS : public PseudoFlattenable
bool EqualsIgnoreInterfaceIndex(const IPAddress & rhs) const {return ((_lowBits == rhs._lowBits)&&(_highBits == rhs._highBits));}

/** @copydoc DoxyTemplate::operator==(const DoxyTemplate &) const */
bool operator == (const IPAddress & rhs) const {return ((EqualsIgnoreInterfaceIndex(rhs))&&(_interfaceIndex == rhs._interfaceIndex));}
bool operator == (const IPAddress & rhs) const {return ((EqualsIgnoreInterfaceIndex(rhs))&&(_interfaceIndex == rhs._interfaceIndex));}

/** @copydoc DoxyTemplate::operator!=(const DoxyTemplate &) const */
bool operator != (const IPAddress & rhs) const {return !(*this == rhs);}
bool operator != (const IPAddress & rhs) const {return !(*this == rhs);}

/** @copydoc DoxyTemplate::operator<(const DoxyTemplate &) const */
bool operator < (const IPAddress & rhs) const
Expand Down

0 comments on commit d6a3e25

Please sign in to comment.