This commit is contained in:
anlicheng 2025-05-05 23:52:55 +08:00
parent df0857142c
commit 20abc1b6c2
3 changed files with 5 additions and 19 deletions

View File

@ -98,10 +98,10 @@ handle_event(info, {connect_reply, Reply}, ?STATE_CONNECTING, State = #state{tra
end;
%%
handle_event(info, {auth_reply, {ok, #auth_reply{code = 1, message = Message, repository_url = RepositoryUrl}}}, ?STATE_AUTH, State = #state{transport_pid = TransportPid}) ->
handle_event(info, {auth_reply, {ok, #auth_reply{code = 1, message = Message, repository_url = RepositoryUrl}}}, ?STATE_AUTH, State) ->
efka_logger:debug("[efka_agent] auth failed, message: ~p, repository_url: ~p", [Message, RepositoryUrl]),
{next_state, ?STATE_ACTIVATED, State};
handle_event(info, {auth_reply, {ok, #auth_reply{code = -1, message = Message}}}, ?STATE_AUTH, State = #state{transport_pid = TransportPid}) ->
handle_event(info, {auth_reply, {ok, #auth_reply{code = -1, message = Message}}}, ?STATE_AUTH, State) ->
%% agent不能推送数据给云端服务器agent
%% socket的连接状态需要维持
efka_logger:debug("[efka_agent] auth denied, message: ~p", [Message]),

View File

@ -163,23 +163,6 @@ receive_data1(RequestId, File) ->
receive_data1(RequestId, File)
end.
-spec extra_filename(Headers :: list(), Default :: string()) -> Filename :: string().
extra_filename(Headers, Default) when is_list(Headers), is_list(Default) ->
case lists:filter(fun({K, _}) -> string:lowercase(K) =:= <<"content-disposition">> end, Headers) of
[{_, <<"attachment; ", Rest/binary>>}|_] ->
Params0 = binary:split(Rest, <<";">>, [global]),
Params = lists:map(fun(P) -> list_to_tuple(binary:split(P, <<"=">>)) end, Params0),
case proplists:get_value(<<"filename">>, Params) of
undefined ->
Default;
Filename0 ->
Filename = binary_to_list(Filename0),
string:trim(Filename, both, "\"")
end;
_ ->
Default
end.
-spec get_filename_from_url(Url :: string()) -> string().
get_filename_from_url(Url) when is_list(Url) ->
URIMap = uri_string:parse(Url),

View File

@ -226,6 +226,9 @@ handle_info({'DOWN', _Ref, process, ChannelPid, Reason}, State = #state{channel_
terminate(Reason, _State = #state{os_pid = OSPid}) ->
lager:debug("[efka_micro_service] terminate with reason: ~p", [Reason]),
kill_os_pid(OSPid),
ok;
terminate(Reason, _State) ->
lager:debug("[efka_micro_service] terminate with reason: ~p", [Reason]),
ok.
%% @private