diff --git a/apps/efka/src/client/efka_client.erl b/apps/efka/src/client/efka_client.erl index e31656c..3a0ff74 100644 --- a/apps/efka/src/client/efka_client.erl +++ b/apps/efka/src/client/efka_client.erl @@ -210,7 +210,7 @@ handle_cast(_Info, State = #state{}) -> {noreply, NewState :: #state{}, timeout() | hibernate} | {stop, Reason :: term(), NewState :: #state{}}). -%% 收到请求的响应 +%% 收到请求的响应, client主动向efka发送的异步请求的响应 handle_info({tcp, Socket, <>}, State = #state{socket = Socket, inflight = Inflight}) -> case jiffy:decode(Packet, [return_maps]) of #{<<"id">> := Id, <<"result">> := Result} -> @@ -254,8 +254,8 @@ handle_info({tcp, Socket, <>}, State = #state{socke {push_config_reply, Ref, {error, Reason}} when is_binary(Reason) -> #{<<"id">> => Id, <<"error">> => #{<<"code">> => -1, <<"message">> => Reason}} end, - Packet = jiffy:encode(Reply, [force_utf8]), - ok = gen_tcp:send(Socket, Packet), + JsonReply = jiffy:encode(Reply, [force_utf8]), + ok = gen_tcp:send(Socket, <>), {noreply, State}; #{<<"id">> := Id, <<"method">> := <<"invoke">>, <<"params">> := #{<<"payload">> := Payload}} -> @@ -268,8 +268,8 @@ handle_info({tcp, Socket, <>}, State = #state{socke {invoke_reply, Ref, {error, Reason}} when is_binary(Reason) -> #{<<"id">> => Id, <<"error">> => #{<<"code">> => -1, <<"message">> => Reason}} end, - Packet = jiffy:encode(Reply, [force_utf8]), - ok = gen_tcp:send(Socket, Packet), + JsonReply = jiffy:encode(Reply, [force_utf8]), + ok = gen_tcp:send(Socket, <>), {noreply, State} end;