Commit fadb2a38 authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #1161 from hurtonm/master

Reset metadata for outbound messages
parents 25de6a03 a54d8d7b
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment