This commit is contained in:
anlicheng 2025-05-06 11:24:56 +08:00
parent 6375eaefe1
commit 11ecea63b7

View File

@ -127,8 +127,7 @@ handle_info({connect_reply, Reply}, State = #state{status = ?STATE_CONNECTING, t
end; end;
handle_info({auth_reply, {ok, ReplyBin}}, State = #state{status = ?STATE_AUTH, transport_pid = TransportPid}) -> handle_info({auth_reply, {ok, ReplyBin}}, State = #state{status = ?STATE_AUTH, transport_pid = TransportPid}) ->
try message_pb:decode_msg(ReplyBin, auth_reply) of #auth_reply{code = Code, message = Message, repository_url = RepositoryUrl} = message_pb:decode_msg(ReplyBin, auth_reply),
#auth_reply{code = Code, message = Message, repository_url = RepositoryUrl} ->
case Code of case Code of
0 -> 0 ->
lager:debug("[efka_agent] auth failed, message: ~p, repository_url: ~p", [Message, RepositoryUrl]), lager:debug("[efka_agent] auth failed, message: ~p, repository_url: ~p", [Message, RepositoryUrl]),
@ -148,13 +147,8 @@ handle_info({auth_reply, {ok, ReplyBin}}, State = #state{status = ?STATE_AUTH, t
lager:debug("[efka_agent] auth failed, invalid message"), lager:debug("[efka_agent] auth failed, invalid message"),
efka_transport:stop(TransportPid), efka_transport:stop(TransportPid),
{noreply, State#state{transport_pid = undefined, status = ?STATE_DENIED}} {noreply, State#state{transport_pid = undefined, status = ?STATE_DENIED}}
end
catch _:Reason ->
%
lager:debug("[efka_agent] auth decode bin get error: ~p", [Reason]),
efka_transport:stop(TransportPid),
{noreply, State#state{transport_pid = undefined, status = ?STATE_DENIED}}
end; end;
handle_info({auth_reply, {error, Reason}}, State = #state{transport_pid = TransportPid, status = ?STATE_AUTH}) -> handle_info({auth_reply, {error, Reason}}, State = #state{transport_pid = TransportPid, status = ?STATE_AUTH}) ->
lager:debug("[efka_agent] auth_request failed, error: ~p", [Reason]), lager:debug("[efka_agent] auth_request failed, error: ~p", [Reason]),
efka_transport:stop(TransportPid), efka_transport:stop(TransportPid),