0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-29 16:45:51 +08:00

70 Commits

Author SHA1 Message Date
Gudmundur Adalsteinsson
7b1fef28f9
Problem: boilerplate when init msg from data copy (#3860)
* Problem: boilerplate when init msg from data copy

Solution: Add zmq_msg_init_buffer to construct
a message by copying memory from buffer.
2020-04-09 23:59:43 +01:00
Luca Boccassi
4f45ac135a Problem: formatting not up to date
Solution: run make clang-format-diff
2020-02-23 18:25:20 +00:00
Luca Boccassi
821685f249
Merge pull request #3822 from somdoron/GROUPMAXLENGTH
problem: maximum size of group doesn't match the RFC maximum size
2020-02-09 13:10:47 +00:00
Doron Somech
05194eb549 problem: maximum size of group doesn't match the RFC maximum size 2020-02-09 14:46:23 +02:00
Luca Boccassi
253e9dd27b Problem: libzmq does not send ZMTP 3.1 sub/cancel commands
Solution: if all peers of a socket are >= 3.1 use sub/cancel commands
instead of the old 0/1 messages.
For backward compatibility, move the handling of 0/1 or sub/cancel
command strings to the encoders, so that the right thing can be done
depending on the protocol version.
Do not set the command flag until the encoder, so that we can handle
the inproc case (which skips the encoder).
2020-02-05 17:03:39 +00:00
Simon Giesecke
db8f4fba21 Problem: redundant inline/ZMQ_FINAL declarations
Solution: remove them
2020-02-04 18:34:13 +01:00
Simon Giesecke
4177bf7445 Problem: curve_encoding_t involves unnecesary heap allocations and copying of message data
Solution: use crypto_box_easy_afternm and crypto_box_open_easy_afternm
in-place
2020-02-03 22:33:15 +01:00
Simon Giesecke
78961eeab7 Problem: non-modifying member functions not marked as const/static
Solution: add const/static
2020-01-27 10:38:00 +01:00
Simon Giesecke
41e3f14d6a Problem: ptr/ref parameters and local variables are non-const but never modified
Solution: add const
2020-01-27 10:38:00 +01:00
Doron Somech
60ef14f80b problem: ws_engine don't support WS RFC close control msg
Solution: when peer send a close msg, close the connection
2020-01-18 19:30:23 +02:00
Luca Boccassi
d70714e877 Problem: can't process ZMTP 3.1 cancel/subscribe commands
Solution: add some msg helpers to parse commands, and check for
subscribe or cancel commands and process them accordingly in the xpub
and xsub classes.
2018-06-23 17:16:10 +01:00
Simon Giesecke
8269b23e56 Problem: magic numbers and code duplication in msg.cpp
Solution: extract constants and unified cases
2018-05-28 17:53:44 +02:00
Simon Giesecke
e3c73d9881 Problem: inconsistent naming style for private data members, conflicts with naming of local variables and member functions
Solution: apply and check _lower_case naming style for private data members
2018-05-27 13:24:07 +02:00
Simon Giesecke
c581f43c97 Problem: parameter naming style inconsistent
Solution: define and apply parameter naming style: lower_case_
2018-05-26 09:34:44 +02:00
sigiesec
41f459e1dc Problem: formatting inconsistent
Solution: applied clang-format
2018-02-02 15:47:43 +01:00
sigiesec
9e7507b38b Problem: term "identity" is confusing
Solution: replace by "routing id"
2017-09-19 17:53:44 +02:00
Doron Somech
af03241dcb Revert "Problem: term "identity" is confusing" 2017-09-07 15:47:43 +03:00
sigiesec
1daf83079a Problem: term "identity" is confusing
Solution: replace by "routing id"
2017-09-06 17:45:56 +02:00
evoskuil
4ea7d01803 Problem: send_failure() util name undergeneralized (for read success). 2017-03-30 13:57:47 -07:00
evoskuil
a014e77ef7 Problem: leaks on send_zap_request fail, use of goto idiom is fragile. 2017-03-29 16:48:40 -07:00
evoskuil
616fbeff21 Problem: insufficient use of const complicates calling. 2017-03-26 00:53:50 -07:00
evoskuil
feb8e868df Problem: typo in comment. 2017-03-25 13:51:18 -07:00
Doron Somech
4012538ce4 problem: srcfd is broken 2016-05-04 15:33:19 +03:00
somdoron
c7d52ec260 radio-dish join/leave are ZMTP commands 2016-01-29 10:53:47 +02:00
somdoron
5054f2eb61 radio-dish is sending the group as first frame 2016-01-29 10:53:47 +02:00
somdoron
68675e23d9 adds group to zmq_msg 2016-01-29 10:53:42 +02:00
somdoron
b2718149e0 msg external storage is using content_t 2016-01-29 10:46:42 +02:00
somdoron
15ad6f8051 save some bytes in msg class 2016-01-28 18:53:35 +02:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
somdoron
669c5697c2 fixing a bug: client over inproc receives msg with routing id set 2016-01-19 20:18:04 +02:00
Pieter Hintjens
87f2dff38c Problem: zmq_msg_get_routing_id () is not consistent with API
We do not use 'get' for getters.

Solution: rename to zmq_msg_routing_id () for public API.
2015-09-11 13:15:00 -04:00
Marin Atanasov Nikolov
fa3b5d8b03 Typo fix 2015-06-23 14:45:51 +03:00
Jens Auer
51cb57e2c9 Fixed wrong handling of shared messages
The shared reference count was not shared but copied. msg_t cannot
store the refcnt itsef but has to store a pointer to an externally
allocated (shared) refcnter. The changes to lmsg are reverted to
use content_t again. Howver, this introduces an allocation in v2_decoder
when creating the message which can be avoided. When allocating the reception
buffer, space is allocated for the maximum number of reference counts
(8192 / max_vsm_size = 8192/64 = 128 zmq:atomic_counter objects). This
increases the buffer by 128*sizeof(atomic_counter) = 128*4 = 512 bytes only.
When creating a message, the refcnt member is set to the address of one of the
pre-allocated atomic_counter_t objects. To do so, a new msg_t type zcmsg
is introduced because msg::copy must discriminate between the message types
when releasing memory.
2015-06-14 13:35:33 +02:00
Jens Auer
611e96c701 Allocation-free msg::init_data
With a msg_t size of 64 bytes, it becomes possible to embedd the content_t's members
struct for large messages directly in the msg_t. This saves the dynamic allocation
of content_t obejcts when using msg_t::init_data.

content_t contains a zmq::atomic_counter_t object which is not a POD in C++98
and thus it cannot be used as a member of the union u. To bypass this, C++11
is used which has relaxed rules for POD and atomic_counter is a C++11-POD. An
alternative would have been to make atomic_counter a classical POD by removing
constructors and all private member functions, i.e. have a struct and free functions
to manipulate it.

A new msg_t::init function is added which decides to either to copy the data for size<64 bytes
or use msg_t::init_data to do zero-copy initialization.
2015-06-03 22:44:33 +02:00
Pieter Hintjens
8620c3e032 Problem: source file headers are somewhat confusing about LGPLv3
Of course people still "can" distributed the sources under the
LGPLv3. However we provide COPYING.LESSER with additional grants.

Solution: specify these grants in the header of each source file.
2015-06-02 22:33:55 +02:00
somdoron
5632b57b4a adds server socket type and routing id to msg 2015-02-02 01:17:37 +02:00
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01:00
Thomas Rodgers
90194036bf Increase size of zmq_msg_t to 64 bytes
Increasing it would have at least two benefits -

* More messages would be 'VSM' messages, so it would reduce allocation
overhead a bit.
* Remove any chance of false sharing of things that are, by design,
pushed by value onto a ypipe_t<msg_t> which is shared between two threads.

The only downside I see is slightly increased memory consumption on memory
constrained applications.

- Full discussion of this rationale is part of issue #1295
2015-01-10 16:44:55 -06:00
Martin Hurton
a54d8d7b0c Reset metadata for outbound messages 2014-08-13 08:53:54 +02:00
Martin Hurton
f2807d11a0 Remove i_properties interface
We use metadata_t directly. No need for generic interface now.
2014-05-03 21:03:49 +02:00
Martin Hurton
19c62b93fc Define i_properties interface
- copy and move message operations are updated to maintain proper
  reference count of properties object
- zmq_msg_gets updated to use i_properties interface to fetch property
  value
- setter/getter added to msg_t class
2014-04-30 14:20:29 +02:00
Martin Hurton
724b2bb844 Add pointer to properties into message structure 2014-04-29 22:37:31 +02:00
Martin Hurton
e46ec31209 Implement socket_base_t::get_credential member function
The get_credential () member function returns
credential for the last peer we received message for.
The idea is that this function is used to implement user-level API.
2014-01-13 00:40:27 +01:00
Martin Hurton
d72ceb93be Make it explicit that the probe function doesn't modify passed message 2014-01-08 08:21:13 +01:00
Stefan Radomski
3aeaa6fab1 ZMQ_SRCFD docs and tests
Also moved the fd field from message content to message itself
2014-01-07 01:09:51 +01:00
Stefan Radomski
f30fb8501e Expose remote FD via zmq_msg_get(&msg, ZMQ_SRCFD)
This patch allows client applications to retrieve the remote endpoint from a message that originated from a tcp socket
2014-01-06 10:31:42 +01:00
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Pieter Hintjens
28b0a5fa27 Updated libzmq to match RFC 23, 24, 25, 26
* Command names changed from null terminated to length-specified
* Command frames use the correct flag (bit 2)
* test_stream acts as test case for command frames
* Some code cleanups
2013-09-04 17:59:45 +02:00
Uli Köhler
a28c38efa5 Fix spaces before comments 2013-08-19 14:45:29 +02:00
Uli Köhler
9c2740d9fa Minor fixes to doc ; added zmq_msg_init_data() assert preventing deferred segfault 2013-08-19 14:28:28 +02:00