mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 02:42:58 +01:00
Reset metadata for outbound messages
This commit is contained in:
parent
25de6a03ac
commit
a54d8d7b0c
@ -288,6 +288,15 @@ void zmq::msg_t::set_metadata (zmq::metadata_t *metadata_)
|
||||
u.base.metadata = metadata_;
|
||||
}
|
||||
|
||||
void zmq::msg_t::reset_metadata ()
|
||||
{
|
||||
if (u.base.metadata) {
|
||||
if (u.base.metadata->drop_ref ())
|
||||
delete u.base.metadata;
|
||||
u.base.metadata = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool zmq::msg_t::is_identity () const
|
||||
{
|
||||
return (u.base.flags & identity) == identity;
|
||||
|
@ -73,6 +73,7 @@ namespace zmq
|
||||
void set_fd (int64_t fd_);
|
||||
metadata_t *metadata () const;
|
||||
void set_metadata (metadata_t *metadata_);
|
||||
void reset_metadata ();
|
||||
bool is_identity () const;
|
||||
bool is_credential () const;
|
||||
bool is_delimiter () const;
|
||||
|
@ -799,6 +799,8 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_)
|
||||
if (flags_ & ZMQ_SNDMORE)
|
||||
msg_->set_flags (msg_t::more);
|
||||
|
||||
msg_->reset_metadata ();
|
||||
|
||||
// Try to send the message.
|
||||
rc = xsend (msg_);
|
||||
if (rc == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user