fix
This commit is contained in:
parent
df0857142c
commit
20abc1b6c2
@ -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]),
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user