fix
This commit is contained in:
parent
12f485f077
commit
2bda5f6d72
@ -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"),
|
||||
@ -174,9 +172,8 @@ 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
|
||||
?STATE_ACTIVATED, State = #state{socket = Socket}) ->
|
||||
case docker_container_service:handle_request(Request) of
|
||||
ok ->
|
||||
send_result_reply(Socket, PacketId, <<"ok">>);
|
||||
{ok, Reply} ->
|
||||
@ -186,11 +183,11 @@ handle_event(internal, {decoded_request, #'RequestFrame'{packet_id = PacketId, b
|
||||
end,
|
||||
{keep_state, State};
|
||||
handle_event(internal, {decoded_request, #'RequestFrame'{packet_id = PacketId, body = _Body}},
|
||||
?STATE_RESTRICTED, State = #state{socket = Socket}) ->
|
||||
?STATE_RESTRICTED, State = #state{socket = Socket}) ->
|
||||
send_error_reply(Socket, PacketId, <<"agent restricted">>),
|
||||
{keep_state, State};
|
||||
handle_event(internal, {decoded_request, #'RequestFrame'{packet_id = PacketId, body = _Body}},
|
||||
_StateName, State = #state{socket = Socket}) ->
|
||||
_StateName, State = #state{socket = Socket}) ->
|
||||
send_error_reply(Socket, PacketId, <<"agent state invalid">>),
|
||||
{keep_state, State};
|
||||
|
||||
@ -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};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user