fix
This commit is contained in:
parent
d32cd25f43
commit
da3ddaf169
@ -12,7 +12,7 @@
|
||||
%% RESPONSE: 对 REQUEST 的响应帧
|
||||
%% CAST: 单向消息帧,不需要响应
|
||||
-define(FRAME_REQUEST, 16#01).
|
||||
-define(FRAME_RESPONSE, 16#02).
|
||||
-define(FRAME_REPLY, 16#02).
|
||||
-define(FRAME_CAST, 16#03).
|
||||
|
||||
%%%% 命令类型子分类, 不需要返回值
|
||||
|
||||
@ -150,7 +150,7 @@ handle_event(info, flush_cache, _, State) ->
|
||||
{keep_state, State};
|
||||
|
||||
%% 处理收到的ssl消息
|
||||
handle_event(info, {ssl, Socket, <<?FRAME_RESPONSE, PacketBin/binary>>}, _, State = #state{socket = Socket}) ->
|
||||
handle_event(info, {ssl, Socket, <<?FRAME_REPLY, PacketBin/binary>>}, _, State = #state{socket = Socket}) ->
|
||||
ReplyFrame = message_pb:decode_msg(PacketBin, 'ReplyFrame'),
|
||||
{keep_state, State, [{next_event, internal, {decoded_reply, ReplyFrame}}]};
|
||||
handle_event(info, {ssl, Socket, <<?FRAME_REQUEST, PacketBin/binary>>}, _, State = #state{socket = Socket}) ->
|
||||
|
||||
@ -9,15 +9,9 @@
|
||||
-module(service_channel).
|
||||
-author("licheng5").
|
||||
-include("efka_tables.hrl").
|
||||
-include("protocol.hrl").
|
||||
-include("service_pb.hrl").
|
||||
|
||||
%% REQUEST: 需要响应的请求帧
|
||||
%% RESPONSE: 对 REQUEST 的响应帧
|
||||
%% CAST: 单向消息帧,不需要响应
|
||||
-define(FRAME_REQUEST, 16#01).
|
||||
-define(FRAME_RESPONSE, 16#02).
|
||||
-define(FRAME_CAST, 16#03).
|
||||
|
||||
%% API
|
||||
-export([init/2]).
|
||||
-export([websocket_init/1, websocket_handle/2, websocket_info/2, terminate/3]).
|
||||
@ -145,7 +139,7 @@ result_reply_packet(PacketId, Result) when is_integer(PacketId), is_binary(Resul
|
||||
packet_id = PacketId,
|
||||
reply = {result, Result}
|
||||
}),
|
||||
<<?FRAME_RESPONSE, Reply/binary>>.
|
||||
<<?FRAME_REPLY, Reply/binary>>.
|
||||
|
||||
-spec error_reply_packet(integer(), integer(), binary()) -> binary().
|
||||
error_reply_packet(PacketId, Code, Message) when is_integer(PacketId), is_integer(Code), is_binary(Message) ->
|
||||
@ -153,4 +147,4 @@ error_reply_packet(PacketId, Code, Message) when is_integer(PacketId), is_intege
|
||||
packet_id = PacketId,
|
||||
reply = {error, #'ServiceReply.Error'{code = Code, message = Message}}
|
||||
}),
|
||||
<<?FRAME_RESPONSE, Reply/binary>>.
|
||||
<<?FRAME_REPLY, Reply/binary>>.
|
||||
Loading…
x
Reference in New Issue
Block a user