diff options
| author | Matthias Radestock <matthias@lshift.net> | 2009-08-29 07:10:38 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@lshift.net> | 2009-08-29 07:10:38 +0100 |
| commit | 118b4e381e592088e83cf3397efe18febdec6ad2 (patch) | |
| tree | 334c0a6476b374543a3c23816fef679bd768296e /src | |
| parent | 40cece9560359da9e268c4111d357134520ae1b5 (diff) | |
| download | rabbitmq-server-git-118b4e381e592088e83cf3397efe18febdec6ad2.tar.gz | |
refactoring: eliminate code duplication in read_message_from_disk
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_disk_queue.erl | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/rabbit_disk_queue.erl b/src/rabbit_disk_queue.erl index 62d53eee7e..0f08b04c0d 100644 --- a/src/rabbit_disk_queue.erl +++ b/src/rabbit_disk_queue.erl @@ -1942,14 +1942,13 @@ read_message_from_disk(FileHdl, TotalSize) -> MsgIdBinSize:?INTEGER_SIZE_BITS, Rest:TotalSizeWriteOkBytes/binary>>} -> BodySize = TotalSize - MsgIdBinSize, - case Rest of - <<_MsgId:MsgIdBinSize/binary, MsgBody:BodySize/binary, - ?WRITE_OK_TRANSIENT:?WRITE_OK_SIZE_BITS>> -> - {ok, {MsgBody, false, BodySize}}; - <<_MsgId:MsgIdBinSize/binary, MsgBody:BodySize/binary, - ?WRITE_OK_PERSISTENT:?WRITE_OK_SIZE_BITS>> -> - {ok, {MsgBody, true, BodySize}} - end; + <<_MsgId:MsgIdBinSize/binary, MsgBody:BodySize/binary, + StopByte:?WRITE_OK_SIZE_BITS>> = Rest, + Persistent = case StopByte of + ?WRITE_OK_TRANSIENT -> false; + ?WRITE_OK_PERSISTENT -> true + end, + {ok, {MsgBody, Persistent, BodySize}}; KO -> KO end. |
