Commit Graph

112 Commits

Author SHA1 Message Date
Simon Giesecke
bf4f75b971
Merge pull request #405 from gummif/gfa/active-poller-handler
Problem: Active poller double add mutates handler
2020-09-07 10:01:26 +02:00
Gudmundur Adalsteinsson
d237615a25 Problem: Active poller double add mutates handler
Solution: Check if socket already added before storing.
2020-09-06 13:46:08 +00:00
or17191
37e6334d5f Bugfix: socket_t move assignment doesn't initialize ctxptr
Until now, we only assigned the _handle on
`zmq::socket_t::operator=(socket_t&&)`. This manifests when trying to
monitor a socket initialized by that constructor.

To avoid changing the public interface of the socket_t class, we tested
for the specific monitor usecase, since it's the only class accessing
zmq::socke_t::ctxptr.

NOTE: When running the new unit-test without the fix, it might hang on
`zmq_socket_monitor(socket_, NULL, 0)`. We haven't figured out the cause
for that, but we deemed it unimportant (or at least out of scope).
2020-07-18 19:17:19 +03:00
Simon Giesecke
89f4d1b187
Merge pull request #408 from gummif/gfa/ctx-handle
Problem: implicit conversion operators in context
2020-06-19 18:10:38 +02:00
Simon Giesecke
452f736fb7
Merge pull request #416 from gummif/gfa/macro-doc
Problem: Feature checking inconsistencies
2020-06-19 18:02:51 +02:00
Gudmundur Adalsteinsson
8b64a341ac Add requirement that the handler is non-null in active_poller 2020-05-24 22:38:35 +00:00
Gudmundur Adalsteinsson
e9c5546e04 Add CHECK_THROWS_ZMQ_ERROR and check error codes 2020-05-24 22:16:55 +00:00
Gudmundur Adalsteinsson
d2c5fef2c1 Apply clang-format 2020-05-24 21:53:56 +00:00
Gudmundur Adalsteinsson
1fc3a9a873 Document macro usage and simplify code 2020-05-24 21:34:42 +00:00
Gudmundur Adalsteinsson
76e6bacc80 Move string literal into variable 2020-05-16 13:22:52 +00:00
Gudmundur Adalsteinsson
6143343edf Fix nodiscard warning 2020-05-16 13:20:48 +00:00
Gudmundur Adalsteinsson
6d71b9b541 Replace checks for C++17 with string view macro 2020-05-16 12:39:54 +00:00
Gudmundur Adalsteinsson
5a3dee082e Problem: implicit conversion operators in context
Solution: add handle() and mark operators as deprecated
2020-05-15 20:38:05 +00:00
Gudmundur Adalsteinsson
4784b74c37 Problem: No endian check in encoding
Solution: Always write message part sizes
using network order.
2020-04-18 13:59:42 +00:00
Gudmundur Adalsteinsson
a3e5b54c3c
Problem: Socket options lack type-safety (#393)
Solution: Implement a type for each socket option.

Each option has an associated type, therefore they
can't be simply defined as an enum class.

Use new sockopt getter in test util

Add socket option get function for strings and tests
2020-03-24 09:33:50 +01:00
Brett Viren
10431084bb
Problem: lack conversion message_t and multipart_t (#391)
Solution: add encode/decode methods to multipart_t giving a codec compatible with the CZMQ equivalent.
2020-03-20 10:59:15 +01:00
Gudmundur Adalsteinsson
5999e5adc7
Problem: Macros not defined in older versions (#386)
* Problem: Macros not defined in older versions

Solution: Guard usage of libzmq macros

* Test older version of libzmq with C++11 or later

* Use a slightly newer libzmq version
2020-02-21 11:29:12 +01:00
Gudmundur Adalsteinsson
324b11f239
Problem: Context lacks typesafe options
Solution: Define an enum class for the context options

Co-Authored-By: Simon Giesecke <simon.giesecke@gmail.com>

Co-authored-by: Simon Giesecke <simon.giesecke@gmail.com>
2020-02-07 15:39:58 +01:00
Simon Giesecke
b6c79eb0c8 Reformat all files with clang-format 2020-01-28 11:11:31 +01:00
Gudmundur Adalsteinsson
47969cfdcf Problem: shutdown() missing for context_t (#377)
Solution: Add shutdown(). This function is required
for clean termination of the zmq context in multi-threaded
applications where sockets are used in threads. In particular
if blocking operation are used and if sockets can be created
at any time.

* Improve tests and documentation
2020-01-27 08:31:46 +01:00
Gudmundur Adalsteinsson
4f9c2ea519 Problem: message_t to string is hard
Solution: add to_string() function.
2020-01-07 19:54:47 +00:00
Gudmundur Adalsteinsson
93e3090eb3 Problem: Missing recv multipart to fixed buffers
Solution: Add recv_multipart_n function
2019-12-05 20:02:38 +00:00
Gudmundur Adalsteinsson
76e5fb04a9 Problem: No multipart tests are begin run
Solution: Move ifdef
2019-11-09 12:40:02 +00:00
Gudmundur Adalsteinsson
41dee3e7a3 Remove comment, fix includes 2019-10-27 10:28:45 +00:00
Gudmundur Adalsteinsson
505edeb336 Problem: Handling multipart messages is complex
Solution: Add generic algorithms for sending and receiving multipart
messages.
2019-10-26 19:59:46 +00:00
Gudmundur Adalsteinsson
4b443fc59b Clarify example requirements 2019-09-14 20:10:47 +00:00
Simon Giesecke
b2fa1192bd
Merge pull request #343 from gummif/gfa/str-buffer
Problem: Sending string literals is awkward
2019-09-13 09:40:08 +02:00
Gudmundur Adalsteinsson
7d9e5cb421 Add user-defined string literals to create buffers 2019-09-11 20:38:47 +00:00
Gudmundur Adalsteinsson
ab588fb7c9 Assertion and constexpr improvements for str_buffer 2019-09-11 20:21:02 +00:00
Gudmundur Adalsteinsson
57d3681ee4 Problem: Strict aliasing warning in tests
Solution: Use memcpy instead of reinterpret_cast
2019-09-10 20:13:45 +00:00
Gudmundur Adalsteinsson
13cc1e0fe9 Problem: Sending string literals is awkward
Solution: A function str_buffer specifically for
creating buffers for null terminated string literals.
2019-09-03 14:06:19 +00:00
Gudmundur Adalsteinsson
4f1ff4952d Fix for lacking SFINAE support on older GCC 2019-08-30 23:14:16 +00:00
Gudmundur Adalsteinsson
9e0b9b4a38 Fix tests 2019-08-30 22:33:49 +00:00
Simon Giesecke
86876d7307
Merge pull request #328 from xiphon/fix-recv-flags-default
Fix 'recv' function 'flags_' argument default value
2019-07-24 14:42:31 +02:00
xiphon
19b5222e4e Fix 'recv' function 'flags_' argument default value 2019-06-02 02:01:42 +00:00
Simon Giesecke
4e37816dfa
Merge pull request #325 from gummif/gfa/msg-range-ctor
Problem: message_t ctor for ranges too greedy
2019-06-01 16:23:46 +02:00
Gudmundur Adalsteinsson
f412ea9e34 Improved range detection supporting ADL 2019-05-31 12:09:20 +00:00
Gudmundur Adalsteinsson
09ab20801a Problem: message_t ctor for ranges too greedy
Solution: Detect ranges with enable_if idiom
2019-05-15 16:49:22 +00:00
Gudmundur Adalsteinsson
0ce8ef06d5 Clean up and test event flags implementation 2019-05-15 11:32:23 +00:00
Gudmundur Adalsteinsson
0458f7d16c Problem: Type-safety of poller_t and active_poller_t can be improved (#318)
Problem: Type-safety of poller_t and active_poller_t can be improved
2019-05-15 08:35:12 +02:00
Gudmundur Adalsteinsson
88cee88d08 Change recv and send to return optional types 2019-05-10 14:22:04 +00:00
Gudmundur Adalsteinsson
809acb2dc8 Make buffer constructors and functions constexpr 2019-05-09 22:47:57 +00:00
Gudmundur Adalsteinsson
99d98dd217 Improved enum flags operators and tests 2019-05-09 22:33:49 +00:00
Simon Giesecke
9a60ad3fc8
Apply suggestions from code review
Co-Authored-By: gummif <ofpgummi@yahoo.com>
2019-05-08 21:37:14 +00:00
Gudmundur Adalsteinsson
3d4be814e8 Problem: send/recv functions lack type-safety
Solution: Add functions taking buffers and enum class flags
2019-05-05 22:05:47 +00:00
Gudmundur Adalsteinsson
c6a3529cd1 Problem: No type-safe alternatives when polling or needing a reference to a socket
Solution: Introduce a socket_ref that is a non-owning nullable reference to a socket
2019-04-19 22:10:26 +00:00
Simon Giesecke
b0ac8acd60
Merge pull request #315 from gummif/gfa/test-warnings
Problem: Compiler warnings in tests
2019-04-15 11:54:05 +02:00
Simon Giesecke
961bb4fb46
Merge pull request #313 from gummif/gfa/socket-ctor
Problem: socket_t can not be default constructed
2019-04-15 10:58:45 +02:00
Gudmundur Adalsteinsson
c2e595bc69 Problem: Compiler warning in tests
Solution: Fix some compiler warnings
2019-04-14 21:34:15 +00:00
Gudmundur Adalsteinsson
4ceabb37b6 Problem: socket_t can not be default constructed
Solution: Provide a default constructor
2019-04-14 12:21:30 +00:00