This commit is contained in:
anlicheng 2026-04-20 19:25:44 +08:00
parent 12f485f077
commit 2bda5f6d72

View File

@ -129,8 +129,6 @@ handle_event(info, {timeout, _, create_transport}, ?STATE_DISCONNECTED, State =
schedule_reconnect(),
{keep_state, State#state{socket = undefined}}
end;
handle_event(info, {timeout, _, create_transport}, _, State) ->
{keep_state, State};
handle_event(state_timeout, auth_timeout, ?STATE_AUTH, State = #state{socket = Socket}) ->
logger:debug("[efka_client] auth request timeout"),
@ -175,8 +173,7 @@ handle_event(info, {ssl_closed, Socket}, _, State = #state{socket = Socket}) ->
%%
handle_event(internal, {decoded_request, #'RequestFrame'{packet_id = PacketId, body = {container_request, Request}}},
?STATE_ACTIVATED, State = #state{socket = Socket}) ->
Result = docker_container_service:handle_request(Request),
case Result of
case docker_container_service:handle_request(Request) of
ok ->
send_result_reply(Socket, PacketId, <<"ok">>);
{ok, Reply} ->
@ -214,9 +211,9 @@ handle_event(internal, {decoded_reply, ReplyFrame}, StateName, State) ->
{keep_state, State};
%%
handle_event(internal, {decoded_cast, #'CastFrame'{
body = {command, #'Command'{command_type = ?COMMAND_AUTH, command = Auth0}}
}}, StateName, State = #state{socket = Socket, next_packet_id = PacketId}) ->
handle_event(internal, {decoded_cast, #'CastFrame'{body = {command, #'Command'{command_type = ?COMMAND_AUTH, command = Auth0}}}},
StateName, State = #state{socket = Socket, next_packet_id = PacketId}) ->
Auth = binary_to_integer(Auth0),
case {Auth, StateName} of
{1, ?STATE_ACTIVATED} ->
@ -231,9 +228,7 @@ handle_event(internal, {decoded_cast, #'CastFrame'{
end;
%% Pub/Sub机制
handle_event(internal, {decoded_cast, #'CastFrame'{
body = {pub, #'Pub'{topic = Topic, qos = Qos, content = Content}}
}}, ?STATE_ACTIVATED, State) ->
handle_event(internal, {decoded_cast, #'CastFrame'{body = {pub, #'Pub'{topic = Topic, qos = Qos, content = Content}}}}, ?STATE_ACTIVATED, State) ->
logger:debug("[efka_client] get pub topic: ~p, qos: ~p, content: ~p", [Topic, Qos, Content]),
efka_subscription:publish(Topic, Qos, Content),
{keep_state, State};