Commit Graph

703 Commits

Author SHA1 Message Date
Simon Giesecke
2c2915a3ea Problem: design goals and supported platforms are not explicitly stated
Solution: add section on design goals and supported platforms to README, improve overall structure of README
2018-05-11 14:09:11 +02:00
Simon Giesecke
421d66c97e Problem: redundant assertion
Solution: removed redundant assertion
2018-05-11 12:31:17 +02:00
Simon Giesecke
762b0131e8 Problem: no tests for poller_t
Solution: add tests
2018-05-11 12:31:17 +02:00
Simon Giesecke
3251d05636 Problem: creation of poller_events is unnecessarily complex
Solution: simplify code
2018-05-11 11:35:11 +02:00
Simon Giesecke
f700e5d6b0 Problem: deprecation warning in multipart_t
Solution: use non-deprecated operator!= instead
2018-05-11 11:33:54 +02:00
Simon Giesecke
ee1cc9a791 Problem: unnecessary heap allocations for test subject
Solution: change to local variables
2018-05-11 11:33:54 +02:00
Simon Giesecke
882f5e844c Problem: extra abstraction layer type poller_t is in zmq.hpp
Solution: move to zmq_addon.hpp, rename to active_poller_t, and rename base_poller_t to poller_t
2018-05-11 11:33:53 +02:00
Simon Giesecke
dc996cd2ec Problem: zmq_addon header contains tests (with a syntax error)
Solution: convert to googletest based test, and fix syntax error
2018-05-11 11:33:53 +02:00
Simon Giesecke
89d9db7366 Problem: move poller tests are unspecific
Solution: remove redundant assertions (tested elsewhere), and add assertion behaviour of calling wait on moved-from poller
2018-05-11 11:02:59 +02:00
Simon Giesecke
bf47be0a0c Problem: poller_t adds an abstraction layer on zmq_poller_*
Solution: extract base_poller_t from poller_t, which provides a direct mapping of zmq_poller_* to C++ only
2018-05-11 11:02:27 +02:00
Simon Giesecke
cdef8bc069
Merge pull request #222 from kurdybacha/poller-init
Problem: poller's constructor is not default generated
2018-05-11 08:12:52 +02:00
Simon Giesecke
e972f39c93
Merge pull request #223 from kurdybacha/server-client
Problem: client/server socket types not defined.
2018-05-11 08:11:30 +02:00
Pawel Kurdybacha
33025bf0e6 Problem: client/server socket types not defined.
Solution: Add ZMQ_CLIENT and ZMQ_SERVER to socket_type enum.
Update some of draft guarded unit tests to use them.
2018-05-11 06:41:53 +01:00
Pawel Kurdybacha
c03fb35173 Problem: poller's constructor is not default
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.
2018-05-11 05:56:07 +01:00
Simon Giesecke
2aba0bb3ac
Merge pull request #221 from kurdybacha/poller-size
Problem: poller move operations not complete
2018-05-09 09:05:48 +02:00
Pawel Kurdybacha
625a0ebb41 Unit tests for poller's move operations 2018-05-09 05:57:44 +01:00
Pawel Kurdybacha
559d373da3 Add back size method, add empty for completeness
As disscussed on #219 PR bringing back `size` method and adding `empty`
for completeness.
2018-05-09 05:44:11 +01:00
Pawel Kurdybacha
4dde37e7b2 Make poller default movable
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.
2018-05-08 21:56:15 +01:00
Luca Boccassi
3281509eda
Merge pull request #220 from zguangyu/patch-1
Fix message using empty version variable
2018-05-08 19:50:23 +01:00
Guangyu Zhang
cfe3bafc1f
Fix message using empty version variable 2018-05-08 09:34:35 -04:00
Pawel Kurdybacha
faf6671d38 Problem: poller can segfault when modified from registered handler. (#219)
* 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.
2018-05-03 21:10:05 +01:00
Luca Boccassi
ac64eba5c6
Merge pull request #218 from kleisauke/patch-3
Problem: Missing QUIET option causes a CMake warning
2018-05-02 14:43:54 +01:00
Kleis Auke Wolthuizen
7d8e3ab473 Problem: Missing QUIET option causes a CMake warning
When libzmq is installed via a package manager, it causes a CMake warning when building cppzmq, which can be safely ignored.
2018-05-02 15:24:30 +02:00
Constantin Rack
13bf7fdb2c
Merge pull request #217 from kurdybacha/cmake_install
Problem: googletest is also installed into install destination
2018-04-29 14:09:13 +02:00
Pawel Kurdybacha
131d2ec487 Problem: googletest is also installed into install destination
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
2018-04-29 12:57:32 +01:00
Luca Boccassi
99b9967970
Merge pull request #216 from kurdybacha/deprecated_draft
Problem: deprecated poller's add method in draft API
2018-04-26 20:05:02 +01:00
Pawel Kurdybacha
94e0fb0bc3 Problem: deprecated poller's method in draft API
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.
2018-04-26 19:50:14 +01:00
Luca Boccassi
17e1d97044
Merge pull request #215 from kurdybacha/poller_modify
Problem: poller_t does not support modify
2018-04-24 21:46:30 +01:00
Pawel Kurdybacha
3fcd58d3f0 Problem: poller_t simple modify test case missing 2018-04-24 21:21:55 +01:00
Pawel Kurdybacha
85e05b0c88 Problem: poller_t does not support modify
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.
2018-04-24 21:16:01 +01:00
Simon Giesecke
dcdf828230
Merge pull request #214 from kurdybacha/appveyor_cache
Problem: Appveyor caches way too much.
2018-04-22 20:44:38 +02:00
Pawel Kurdybacha
c3d11f32fe Problem: Missing -D flag causes build failure. 2018-04-22 18:09:10 +01:00
Pawel Kurdybacha
85d5667d73 Problem: Appveyor caches way too much.
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.
2018-04-22 17:57:55 +01:00
Simon Giesecke
a87cc96f76
Merge pull request #213 from kurdybacha/appveyor_cache
Problem: Appveyor Windows build does not cache googletest
2018-04-22 10:09:15 +02:00
Pawel Kurdybacha
1baec268e6 Problem: Appveyor Windows build does not cache googletest
Solution: add googletest build directory to cache
2018-04-21 21:58:47 +01:00
Pawel Kurdybacha
82a7f76594 Problem: Appveyor build is slow. (#212)
* Problem: Appveyor Windows build is slow

Solution: use Appveyor caching for libzmq dependency
2018-04-20 11:44:21 +01:00
Simon Giesecke
d103401ec3
Merge pull request #211 from kurdybacha/add_throws
Problem: poller_t's deprecated add might throw std::bad_function_call
2018-04-20 08:50:34 +02:00
Pawel Kurdybacha
c55379d6e2 Problem: poller_t's deprecated add might throw std::bad_function_call
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.
2018-04-20 06:16:04 +01:00
Simon Giesecke
85a9805f16
Merge pull request #208 from kurdybacha/poller-fix
Problem: poller_t invalid behavior on moved sockets
2018-04-19 17:53:00 +02:00
Luca Boccassi
e317fc873a
Merge pull request #210 from kleisauke/patch-2
Problem: tests are always building
2018-04-19 11:57:50 +01:00
Kleis Auke Wolthuizen
0611afecb9 Problem: tests are always building
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.
2018-04-19 12:45:29 +02:00
Pawel Kurdybacha
f5b9fcc4ef Problem: throw error_t should follow only zmq call. 2018-04-18 19:23:26 +01:00
Pawel Kurdybacha
810b87c021 Problem: poller_t invalid behaviour on invalid sockets
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.
2018-04-18 07:00:41 +01:00
Constantin Rack
60f7753133
Merge pull request #207 from kleisauke/patch-1
Remove unnecessary curly bracket
2018-04-17 20:56:07 +02:00
Kleis Auke Wolthuizen
21aad1a92a
Remove unnecessary curly bracket
Will otherwise write `set(PACKAGE_VERSION "4.3.0}")` to `cppzmqConfigVersion.cmake`.
2018-04-17 20:34:29 +02:00
Pawel Kurdybacha
fdc145a09e Problem: Windows build broken because of multiple issues (#204)
* 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
2018-04-17 09:29:47 +01:00
Luca Boccassi
19da7a4cf6
Merge pull request #205 from sigiesec/split-testcases
Improved tests and implementation of message_t
2018-04-16 14:52:51 +01:00
Luca Boccassi
a186ed6ada
Merge pull request #203 from kurdybacha/master
Problem: message_t could be easier to construct and is missing equal not equal operators
2018-04-14 15:54:56 +01:00
Pawel Kurdybacha
f518a648ef Problem: extended initializer lists only available in C++11 2018-04-14 14:06:32 +01:00
Pawel Kurdybacha
6caa5d19d3 Problem: message_t should be easier to construct
* 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
2018-04-14 12:13:44 +01:00