From b2eb84f8ca2fc2b8a2af6cd2c54c0abc4535cfc4 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 29 Apr 2011 07:19:22 +0200 Subject: Substantial simplification of uuid_t The string format of UUID is not used in 0MQ. Further on, it turns out that UUIDs have fixed microarchitecture-agnostic binary layout (see RFC4122). Thus, the conversion to string and back to binary can be avoided. Signed-off-by: Martin Sustrik --- src/zmq_init.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/zmq_init.cpp') diff --git a/src/zmq_init.cpp b/src/zmq_init.cpp index ca7c66d..ea3b55d 100644 --- a/src/zmq_init.cpp +++ b/src/zmq_init.cpp @@ -47,10 +47,9 @@ zmq::zmq_init_t::zmq_init_t (io_thread_t *io_thread_, alloc_assert (engine); // Generate an unique identity. - unsigned char identity [uuid_t::uuid_blob_len + 1]; - identity [0] = 0; - memcpy (identity + 1, uuid_t ().to_blob (), uuid_t::uuid_blob_len); - peer_identity.assign (identity, uuid_t::uuid_blob_len + 1); + peer_identity.resize (17); + peer_identity [0] = 0; + generate_uuid (&peer_identity [1]); // Create a list of props to send. msg_t msg; -- cgit v1.2.3