chore(dsrepl): simplify snapshot transfer code a bit

Co-Authored-By: Thales Macedo Garitezi <thalesmg@gmail.com>
This commit is contained in:
Andrew Mayorov 2024-03-27 15:48:09 +01:00
parent e029b8f996
commit 7cebf598a8
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 4 additions and 4 deletions

View File

@ -145,11 +145,11 @@ read_chunk_file(RelPath, RFile0 = #rfile{fd = IoDev, pos = Pos, abspath = AbsPat
ChunkSize = byte_size(Chunk),
HasMore = ChunkSize div Size,
RFile1 = RFile0#rfile{pos = Pos + ChunkSize},
case ChunkSize < Size of
false ->
case HasMore of
_Yes = 1 ->
Status = next,
RFile = RFile1;
true ->
_No = 0 ->
Status = last,
RFile = release_reader_file(RFile1)
end,
@ -315,7 +315,7 @@ make_packet(Header, Rest) ->
parse_packet(Packet) ->
try binary_to_term(Packet, [safe, used]) of
{Header = ?PAT_HEADER(), Length} ->
Rest = binary:part(Packet, Length, byte_size(Packet) - Length),
{_, Rest} = split_binary(Packet, Length),
{Header, Rest};
{Header, _} ->
{error, {bad_header, Header}}