Correctly use string:lexemes/2

This commit is contained in:
Michael Klishin 2021-02-24 20:31:10 +03:00
parent 33d8ac4f79
commit 7ba2bde260
No known key found for this signature in database
GPG Key ID: E80EDCFA0CDB21EE
1 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ compute_key_and_suffix_v1(Pid) ->
-spec decode_reply_to_v1(binary()) -> decoded_pid_and_key() | {error, any()}.
decode_reply_to_v1(Bin) ->
case string:lexemes(Bin, ["."]) of
case string:lexemes(Bin, ".") of
[PidEnc, Key] -> Pid = binary_to_term(base64:decode(PidEnc)),
{ok, Pid, unicode:characters_to_binary(Key)};
_ -> {error, unrecognized_format}
@ -63,7 +63,7 @@ compute_key_and_suffix_v2(Pid) ->
-spec decode_reply_to_v2(binary(), #{non_neg_integer() => node()}) -> decoded_pid_and_key() | {error, any()}.
decode_reply_to_v2(Bin, CandidateNodes) ->
case string:lexemes(Bin, ["."]) of
case string:lexemes(Bin, ".") of
[PidEnc, Key] ->
RawPidBin = base64:decode(PidEnc),
PidParts0 = #{node := ShortenedNodename} = pid_recomposition:from_binary(RawPidBin),