-
Before, was relying on constructing an std::string from a char* that was assumed to be null terminated. Now, specify length explicitly.
-
With compiler warning -Wstrict-aliasing enabled, usage of the macros ev_async_timer and ev_timer_init yields said warnings. Created templates to locally turn off these warnings. Compiles without warnings with gcc 4.9.2 and clang 3.5.
-
* Use lock_guard instead of unique_lock when possible * Make a few types non-atomic since they are already guarded by a mutex * Create setVariable helpers that lock and notify
-
…ill make debugging easier if the error condition does occur.
-
Very similar to the fixes for Command and Subscriber, adds locking around booleans used as flags for condition variables.
-
Similar to the fixes for subscriber, without holding the waiter_lock_, updating the waiting_done_ flag may cause deadlock. In the deadlock example below, Thread1 is waiting for the response, thread 2 is processing the response and updating the waiter_lock_ variable: ---------------------------------------------------- | Thread 1 | Thread 2 | ---------------------------------------------------- | locks 'waiter_lock_' | | | check 'waiting_done_' | | | | Update 'waiting done' | | | Send notification | | begin waiting for signal | | | *deadlocked* | | ----------------------------------------------------
-
The lock used with the condition variable should always be the same one guarding changes to the condition itself, in these cases, the lock guarding changes to the subscribe and psubscibe data structures. This commit also limits the number of locks held by the subscribeBase function at any one time.
-
In case of a connection failure (i.e. specify incorrect port number), the main thread would be blocked. This is fixed by setting the condition variables correctly in case of a connection error. The test TestConnectionFailure will hang without this fix.
-
Add EVRUN_ONCE evloop call at the start of the event loop thread, instead of just an EVRUN_NOWAIT call. We want to block until the connection happens, or else we hang on the condition variable wait.
-
User can now enable no-wait mode, which chooses whether we use the EVRUN_NOWAIT flag in ev_run. The default is off, so that we don't use 100% CPU. Note added in tutorial to enable when performance is critical. Added to the speed test examples. Bump to 0.2.1. Remove patch number from HISTORY entry - that's what the git log is for. Make note on minor release.
-
Instructions in README, some minor changes to comments.
-
This enables full support for binary data, with no tokenization needed and all the assumptions that come with that. All of the core methods are changed to accept vector<string>& instead of string&. Ported all examples and tutorial as well.
-
Call Redox::disconnectCallback from processReply
-
This makes more sense logically, and lets the Redox object get default constructed with nothing but the optional logger parameters.
-
Separate include directory so that examples can reference the same thing whether installed in the system or from the local folder.
-
More intuitive if disconnect() blocks like connect(). Most clients will want to use these two methods. For more fine grained control, disconnect() is just a combo of stop() and wait().
-
Configure CMake to generate libredox.so and libredox_static.a, and have all examples use the dynamic library. This is how Redox should be used in practice, and greatly reduces the compilation time of the examples. Also renamed redox.[ch]pp to client.[ch]pp and created one master header redox.hpp for users to include. This header right now just includes client.hpp, command.hpp, and subscriber.hpp.
-
Make .free() on commands send a message over an async watcher to the event loop, just like adding commands. This gets rid of some very tough to find memory bugs. Combined .cancel() with .free(), so there is only one method to call, whether for synchronous commands or for looped commands. Also debug some horrible segfaults related to Subscriber. Something is odd with hiredis and subscriptions, need to ask them. It seems when we flood with commands it doesn't disconnect cleanly. Look for a way to wait until all commands are processed.
-
Conform (mostly) to Google C++ guidelines. Apache license notice and link above each core file.
-
Refactor state management code to use three methods .connect(), .disconnect(), and .wait(). Start conforming to uniform coding style already applied to Command class. Split off subscribe functionality into its own class Subscriber. This is good because it was introducing unnecessary state and complexity into the main client. Now, Redox handles publishing like any other command and the Subscriber receives messages.
-
Using free_guard_ as the same mutex in .reply() causes deadlock when a callback accesses .reply(). Make a separate mutex.
-
Also make cmd.reply() copy the value and use a mutex to make it thread safe. No noticable speed hits, probably thanks to RVO.
-
Split up command into command, command_blocking, and command_looping. The original command no longer returns anything, which clarifies how it should be used in most cases. command_looping and command_blocking both return a command object. Also added a waiting CV to the Command object, though it is not used in command_blocking yet.
-
Now, there is only one callback for command(), and it returns a const reference to the Command object. The user is responsible for error checking using c.ok(), c.status(), and getting the reply with c.reply(). This significantly cleans up the library code and the user code. Greatly refactored the data type specialization code in command.cpp.
-
* Member variables with trailing underscore * Methods camelCase * Explicit template instantiation, move definitions to .cpp * Reorder methods to make more sense * Limit public API, comment well
-
subscribe/psubscribe/unsubscribe/punsubscribe methods that keep track of subscribed topics to make sure we don't ask hiredis for bad things. It appears all crashes are eliminated, though no stress testing has been done.
-
subscribe/unsubscribe/publish with proper and working callbacks. Guard added that throws an exception if a non-pubsub command is issued after a subscribe. Also removed all std:: prefixes from redox.cpp. Just made the decision for "using namespace std" there for readability. Not a header, of course. Also added another async watcher for breaking the loop, since ev_break doesn't actually do anything when called outside of an ev_run callback.
-
utils/logger.[ch]pp gives a logger implementation based on ostringstream that is pretty nice. I took this from Stack Overflow and added some things to make syntax nicer. Changed all cout and cerr statements in Redox to be of the form logger.{debug/info/warning/error/fatal}() << stuff. Arguments for non-printed statements are still evaluated. Gives a performance hit if we actually add statements on every callback and run speed tests. For most use cases, doesn't matter. For now, not including such low level output anyway. Would be nice to have a macro to leave out/include the low-level logs at compile-time.