Solution: Constructor logic moved to the same place where cleanup is and
marking constructor `default`. Init/cleanup code is in one pleace making
it easier to read/maintain.
Latest modification to the poller made move constructor and move
assigment operator not complete. In order to prevent that in the future
poller should be default movable. Unique pointer has been used to
manager zmq_poller. That makes code simpler and safer now.
* Problem: poller can segfault when modified from registred handler.
It is possible that a user would like to add/remove sockets from
handlers. As handlers and poll items might be removed while not
being processed yet - we have a segfault situation.
Provided unit test `remove_from_handler` demonstrates the problem.
Solution: Modify internal poll item data structure only after processing
of events is finished.
Please not that events processing path performance remains the same when there are
no modification (add/remove) to the poller (no rebuild) - main real use case.
As an effect of changes `size()` method has been removed as it does not
represent any meaningful information anymore. There are active and pending
(waiting for rebuild) poll items so two different sizes. User can
easily track on their side number of registered sockets if original size
information is needed.
`wait` method returns number of processed sockets now. It might be
useful information to a user for no extra cost.
Building and installing cppzmq brings googletest build artifacts to the
installation destination as well. For example someone building cppzmq
with:
```
cmake -DCMAKE_INSTALL_PREFIX=mydest .
cmake --build --target install
```
gets googletest headers and libraries in `mydest`.
Solution: remove googletest from install target
We have a deprecated method `add` in poller that contradicts purpose of a draft
API where it can change without deprecation period.
Solution: remove the method so we do not to maintain it anymore.
Solution: Added `modify` method based on `zmq_poller_modify` and test cases
covering it.
Reduced code duplication in existing test cases by introducing
`client_server_setup` helper struct.
Currently appveyor caches whole libzmq directory with all sources and
build artifacts (349MB uncompressed).
Solution: install build artifacts to separate `libzmq` directory and
cache only this (~52.70MB uncompressed).
That way we can save some space on shared cache volume that is 1GB
(compressed data) now.
Issue is reproducible in deprecated add method with empty handler
followed by wait that kicks in (covered by provided unit test).
I would prefer we remove this method completely as maintaining something
that we consider `deprecated` is unnecessary in `draft` API.
Add the ability to explicitly not build tests. Option defaults to ON to keep the current behavior, but give the user the option to disable building of tests.
On adding invalid socket (e.g. after move) there was exception thrown
but leaving modified and unconsistent internal state.
Besides that there was no possibility to remove a socket that was moved
into.
Solutions: check for socket validity (added operator bool) and changed
internal unordered_map "handlers" to operator on zmq internal pointers.
Added two test cases covering the issues.
* Problem: Windows build broken because of multiple issues
Windows issues:
* missing includes files
Solution: added missing <memory> and <unordered_map>
Here <map> was replaced with <unordered_map> as there is no need for
sorted map.
* googletest fails because deprecation warning causing errors.
Solution: D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING option added.
* googletest fails because by default, new Visual Studio projects
link the C runtimes dynamically but Google Test links them statically.
Solution: gtest_force_shared_crt=ON option added.
Besides that adding appveyor.yml configuration to add Windows build to
CI in order to prevent accidental Windows build breakage.
For now only Debug configuration as Release requires more time to figure
out.
* Problem: Windows build takes too long
Solution: disabling tests and perf tools
* Problem: Windows unit_tests executable not finding lizmq dll.
Solution: copy libzmq dll to build bin directory.
* Problem: Windows build fails because wrong test path provided
* Added overload constructor (c++11 only) taking iteratable object.
It would be easier to use std::string, std::array etc to construct
a message now. Making it a draft for now in case it is too greedy
and needs to be more specialize.
* Added equal and not euqal operator to message_t as a recommended
and expected way of comparing objects in C++.
* deprecated C style equal method as operator== should be used instead
(point above).
* Added message_t test covering all available message_t's constructors