mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-15 10:18:01 +08:00
resolve #1347 addresses issue of no metadata on identity frame
This commit is contained in:
parent
5b6b850d9a
commit
f75ed8565e
@ -245,6 +245,12 @@ bool zmq::stream_t::xhas_in ()
|
|||||||
blob_t identity = pipe->get_identity ();
|
blob_t identity = pipe->get_identity ();
|
||||||
rc = prefetched_id.init_size (identity.size ());
|
rc = prefetched_id.init_size (identity.size ());
|
||||||
errno_assert (rc == 0);
|
errno_assert (rc == 0);
|
||||||
|
|
||||||
|
// forward metadata (if any)
|
||||||
|
metadata_t *metadata = prefetched_msg.metadata();
|
||||||
|
if (metadata)
|
||||||
|
prefetched_id.set_metadata(metadata);
|
||||||
|
|
||||||
memcpy (prefetched_id.data (), identity.data (), identity.size ());
|
memcpy (prefetched_id.data (), identity.data (), identity.size ());
|
||||||
prefetched_id.set_flags (msg_t::more);
|
prefetched_id.set_flags (msg_t::more);
|
||||||
|
|
||||||
|
@ -85,6 +85,9 @@ test_stream_to_dealer (void)
|
|||||||
rc = zmq_recv (stream, buffer, 255, 0);
|
rc = zmq_recv (stream, buffer, 255, 0);
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
|
|
||||||
|
// Verify the existence of Peer-Address metadata
|
||||||
|
assert (streq (zmq_msg_gets (&identity, "Peer-Address"), "127.0.0.1"));
|
||||||
|
|
||||||
// Real data follows
|
// Real data follows
|
||||||
// First frame is identity
|
// First frame is identity
|
||||||
rc = zmq_msg_recv (&identity, stream, 0);
|
rc = zmq_msg_recv (&identity, stream, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user