summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-01-31 14:04:46 +0000
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-01-31 14:04:46 +0000
commit39203f424b3fae4a085803bc47665e52f752ddac (patch)
treeb839fcb3e6ef4c1d8f014c8779b5e8471eaa2791
parent25c69871c29d9a2361000cde453e194a8bbf8a76 (diff)
downloadrabbitmq-server-39203f424b3fae4a085803bc47665e52f752ddac.tar.gz
Better comment for gen/0.
-rw-r--r--src/rabbit_basic.erl2
-rw-r--r--src/rabbit_guid.erl7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl
index 55bbdf3a..85a18c71 100644
--- a/src/rabbit_basic.erl
+++ b/src/rabbit_basic.erl
@@ -139,7 +139,7 @@ message(XName, RoutingKey, #content{properties = Props} = DecodedContent) ->
{ok, #basic_message{
exchange_name = XName,
content = strip_header(DecodedContent, ?DELETED_HEADER),
- id = rabbit_guid:gen_secure(),
+ id = rabbit_guid:gen(),
is_persistent = is_message_persistent(DecodedContent),
routing_keys = [RoutingKey |
header_routes(Props#'P_basic'.headers)]}}
diff --git a/src/rabbit_guid.erl b/src/rabbit_guid.erl
index 5751d660..d17144bc 100644
--- a/src/rabbit_guid.erl
+++ b/src/rabbit_guid.erl
@@ -90,9 +90,10 @@ blocks_to_binary({B1, B2, B3, B4}) ->
%% generate a GUID. This function should be used when performance is a
%% priority and predictability is not an issue. Otherwise, use gen_secure/0.
gen() ->
- %% We hash a fresh GUID with md5, split it in 5 blocks, and each time we
- %% need a new guid we hash the first block and the counter and xor the
- %% result with the remaining blocks.
+ %% We hash a fresh GUID with md5, split it in 4 blocks, and each time we
+ %% need a new guid we hash the first block and the counter and XOR the
+ %% result with the remaining blocks, removing the first block and inserting
+ %% the hash as the last block.
{BS, I} =
case get(guid) of
undefined ->