mirror of
https://github.com/zeromq/libzmq.git
synced 2025-07-04 09:37:15 +02:00
Problem: Message metadata properties still refer to "identity"
Solution: Renamed, but support querying the property by its old name
This commit is contained in:
parent
27c7e52a5a
commit
fab57634b4
@ -622,8 +622,7 @@ ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group);
|
||||
ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg);
|
||||
|
||||
/* DRAFT Msg property names. */
|
||||
// TODO the name of the define AND its value are now inconsistent with the new term "routing id"
|
||||
#define ZMQ_MSG_PROPERTY_IDENTITY "Identity"
|
||||
#define ZMQ_MSG_PROPERTY_ROUTING_ID "Routing-Id"
|
||||
#define ZMQ_MSG_PROPERTY_SOCKET_TYPE "Socket-Type"
|
||||
#define ZMQ_MSG_PROPERTY_USER_ID "User-Id"
|
||||
#define ZMQ_MSG_PROPERTY_PEER_ADDRESS "Peer-Address"
|
||||
|
@ -132,11 +132,11 @@ size_t zmq::mechanism_t::add_basic_properties (unsigned char *buf,
|
||||
ZMQ_MSG_PROPERTY_SOCKET_TYPE, socket_type,
|
||||
strlen (socket_type));
|
||||
|
||||
// Add identity property
|
||||
// Add routing id property
|
||||
if (options.type == ZMQ_REQ || options.type == ZMQ_DEALER
|
||||
|| options.type == ZMQ_ROUTER)
|
||||
ptr += add_property (ptr, buf_capacity - (ptr - buf),
|
||||
ZMQ_MSG_PROPERTY_IDENTITY, options.routing_id,
|
||||
ZMQ_MSG_PROPERTY_ROUTING_ID, options.routing_id,
|
||||
options.routing_id_size);
|
||||
|
||||
return ptr - buf;
|
||||
@ -148,7 +148,7 @@ size_t zmq::mechanism_t::basic_properties_len() const
|
||||
return property_len (ZMQ_MSG_PROPERTY_SOCKET_TYPE, strlen (socket_type))
|
||||
+ ((options.type == ZMQ_REQ || options.type == ZMQ_DEALER
|
||||
|| options.type == ZMQ_ROUTER)
|
||||
? property_len (ZMQ_MSG_PROPERTY_IDENTITY,
|
||||
? property_len (ZMQ_MSG_PROPERTY_ROUTING_ID,
|
||||
options.routing_id_size)
|
||||
: 0);
|
||||
}
|
||||
@ -199,7 +199,7 @@ int zmq::mechanism_t::parse_metadata (const unsigned char *ptr_,
|
||||
ptr_ += value_length;
|
||||
bytes_left -= value_length;
|
||||
|
||||
if (name == ZMQ_MSG_PROPERTY_IDENTITY && options.recv_routing_id)
|
||||
if (name == ZMQ_MSG_PROPERTY_ROUTING_ID && options.recv_routing_id)
|
||||
set_peer_routing_id (value, value_length);
|
||||
else
|
||||
if (name == ZMQ_MSG_PROPERTY_SOCKET_TYPE) {
|
||||
|
@ -40,7 +40,13 @@ const char *zmq::metadata_t::get (const std::string &property) const
|
||||
{
|
||||
dict_t::const_iterator it = dict.find (property);
|
||||
if (it == dict.end())
|
||||
{
|
||||
/** \todo remove this when support for the deprecated name "Identity" is dropped */
|
||||
if (property == "Identity")
|
||||
return get (ZMQ_MSG_PROPERTY_ROUTING_ID);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return it->second.c_str ();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user