diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-08-21 09:38:16 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-08-21 09:38:16 +0100 |
commit | 413551fe76926c74c0e7ae6c5296b01812b7187f (patch) | |
tree | d97e53757da44f03efca9328ae11d2956289c03c | |
parent | c9e8d16fb226aa4371391f52bd59187c20436891 (diff) | |
download | rabbitmq-server-413551fe76926c74c0e7ae6c5296b01812b7187f.tar.gz |
Avoid binary:split/2.
-rw-r--r-- | src/rabbit_channel.erl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 418653df..59453385 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -174,12 +174,13 @@ declare_fast_reply_to(<<"amq.rabbitmq.reply-to.", Rest/binary>>) -> declare_fast_reply_to(_) -> not_found. -decode_fast_reply_to(Suffix) -> - case binary:split(Suffix, <<".">>) of - [PidEnc, Key] -> Pid = binary_to_term(base64:decode(PidEnc)), - {ok, Pid, Key}; - _ -> error - end. +%% It's inelegant to depend on the encoded lengths here, but +%% binary:split/2 does not exist in R13B03. +decode_fast_reply_to(<<PidEnc:40/binary, ".", Key:24/binary>>) -> + Pid = binary_to_term(base64:decode(PidEnc)), + {ok, Pid, Key}; +decode_fast_reply_to(_) -> + error. send_credit_reply(Pid, Len) -> gen_server2:cast(Pid, {send_credit_reply, Len}). |