diff options
| author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-01-31 13:55:53 +0000 |
|---|---|---|
| committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-01-31 13:55:53 +0000 |
| commit | ff722cfaee7b255fc83c1d775dcc0084f2d2d1f9 (patch) | |
| tree | 4261b969b5f3e08cd44c57e5faee1bf5261aa17f | |
| parent | 6f6f1da0aa28059bdc4761a1bde6ca9ee53d8740 (diff) | |
| download | rabbitmq-server-git-ff722cfaee7b255fc83c1d775dcc0084f2d2d1f9.tar.gz | |
Update comment for gen/0.
| -rw-r--r-- | src/rabbit_basic.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_guid.erl | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl index 85a18c7185..55bbdf3a77 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(), + id = rabbit_guid:gen_secure(), 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 4fe6eaee45..5751d660a3 100644 --- a/src/rabbit_guid.erl +++ b/src/rabbit_guid.erl @@ -90,8 +90,9 @@ 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 and then XOR it with a process-local counter - %% to get a new GUID each time. + %% 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. {BS, I} = case get(guid) of undefined -> |
