feat(ft): ensure that clientid is always binary
For the sake of simplicity (e.g. transfer ids are now easier to compare).
This commit is contained in:
parent
4f2600b9f1
commit
45f00e14a9
|
@ -51,7 +51,7 @@
|
||||||
-type bytes() :: non_neg_integer().
|
-type bytes() :: non_neg_integer().
|
||||||
|
|
||||||
%% MQTT Client ID
|
%% MQTT Client ID
|
||||||
-type clientid() :: emqx_types:clientid().
|
-type clientid() :: binary().
|
||||||
|
|
||||||
-type fileid() :: binary().
|
-type fileid() :: binary().
|
||||||
-type transfer() :: {clientid(), fileid()}.
|
-type transfer() :: {clientid(), fileid()}.
|
||||||
|
@ -327,7 +327,7 @@ assemble(Transfer, FinalSize) ->
|
||||||
|
|
||||||
transfer(Msg, FileId) ->
|
transfer(Msg, FileId) ->
|
||||||
ClientId = Msg#message.from,
|
ClientId = Msg#message.from,
|
||||||
{ClientId, FileId}.
|
{clientid_to_binary(ClientId), FileId}.
|
||||||
|
|
||||||
on_complete(Op, {ChanPid, PacketId}, Transfer, Result) ->
|
on_complete(Op, {ChanPid, PacketId}, Transfer, Result) ->
|
||||||
?SLOG(debug, #{
|
?SLOG(debug, #{
|
||||||
|
@ -421,3 +421,8 @@ parse_checksum(Checksum) when is_binary(Checksum) andalso byte_size(Checksum) =:
|
||||||
end;
|
end;
|
||||||
parse_checksum(_Checksum) ->
|
parse_checksum(_Checksum) ->
|
||||||
{error, invalid_checksum}.
|
{error, invalid_checksum}.
|
||||||
|
|
||||||
|
clientid_to_binary(A) when is_atom(A) ->
|
||||||
|
atom_to_binary(A);
|
||||||
|
clientid_to_binary(B) when is_binary(B) ->
|
||||||
|
B.
|
||||||
|
|
Loading…
Reference in New Issue