diff --git a/src/transport/tcp/ssl_channel.erl b/src/transport/tcp/ssl_channel.erl index 67e9eda..4c6d251 100644 --- a/src/transport/tcp/ssl_channel.erl +++ b/src/transport/tcp/ssl_channel.erl @@ -13,7 +13,7 @@ -define(INFLIGHT_TIMEOUT, 60000). %% API --export([pub/4, container_call/4, cancel_command_call/2, activate/4]). +-export([pub/4, container_call/4, cancel_command_call/2]). -export([start_link/3, stop/2]). %% gen_server callbacks @@ -41,12 +41,6 @@ pub(Pid, Topic, Qos, Content) when is_pid(Pid), is_binary(Topic), is_integer(Qos), is_binary(Content) -> gen_server:cast(Pid, {pub, Topic, Qos, Content}). --spec activate(Pid :: pid(), ReceiverPid :: pid(), Ref :: reference(), Auth :: boolean()) -> ok. -activate(Pid, ReceiverPid, Ref, Auth) when is_pid(Pid), is_pid(ReceiverPid), is_reference(Ref), is_boolean(Auth) -> - Command = case Auth of true -> activate; false -> deactivate end, - gen_server:cast(Pid, {command_call, ReceiverPid, Ref, {auth, Command}}), - ok. - -spec container_call(Pid :: pid(), ReceiverPid :: pid(), Ref :: reference(), Request :: map()) -> ok. container_call(Pid, ReceiverPid, Ref, Request) when is_pid(Pid), is_pid(ReceiverPid), is_reference(Ref), is_map(Request) -> gen_server:cast(Pid, {command_call, ReceiverPid, Ref, {container, Request}}), @@ -75,7 +69,6 @@ init(Ref, Transport, _Opts = []) -> {ok, Socket} = ranch:handshake(Ref), logger:debug("[ssl_channel] get a new connection: ~p", [Socket]), Transport:setopts(Socket, [binary, {active, true}, {packet, 4}]), - % erlang:start_timer(?PING_TICKER, self(), ping_ticker), gen_server:enter_loop(?MODULE, [], #state{transport = Transport, socket = Socket}). handle_call({cancel_command_call, Ref}, _From, State = #state{inflight = Inflight}) -> @@ -187,11 +180,6 @@ handle_request_frame(Ref, {auth_request, #{uuid := UUID, token := Token, timesta erlang:monitor(process, HostPid), send_reply_frame(Transport, Socket, Ref, {auth_response, ok}), {noreply, State#state{uuid = UUID, host_pid = HostPid}}; - {denied, Reason} when is_binary(Reason) -> - erlang:monitor(process, HostPid), - send_reply_frame(Transport, Socket, Ref, {auth_response, {error, {denied, Reason}}}), - logger:debug("[ws_channel] uuid: ~p, attach channel get error: ~p, stop channel", [UUID, Reason]), - {noreply, State#state{uuid = UUID, host_pid = HostPid}}; {error, Reason} when is_binary(Reason) -> send_reply_frame(Transport, Socket, Ref, {auth_response, {error, {failed, Reason}}}), logger:debug("[ws_channel] uuid: ~p, attach channel get error: ~p, stop channel", [UUID, Reason]), @@ -257,10 +245,6 @@ decode_command_response({container, {ok, Result}}) -> {ok, Result}; decode_command_response({container, {error, Reason}}) -> {error, Reason}; -decode_command_response({auth, ok}) -> - ok; -decode_command_response({auth, {error, Reason}}) -> - {error, Reason}; decode_command_response(_Reply) -> {error, invalid_response}.