From cc6ea6e4dd8052746468aae2a3f7431204b0d6b8 Mon Sep 17 00:00:00 2001 From: JianBo He Date: Tue, 2 Nov 2021 13:55:57 +0800 Subject: [PATCH] chore(stomp): remove needless properties --- apps/emqx_stomp/src/emqx_stomp.appup.src | 4 +-- apps/emqx_stomp/src/emqx_stomp_connection.erl | 29 +++++-------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/apps/emqx_stomp/src/emqx_stomp.appup.src b/apps/emqx_stomp/src/emqx_stomp.appup.src index 30cf9f908..8a3e7e720 100644 --- a/apps/emqx_stomp/src/emqx_stomp.appup.src +++ b/apps/emqx_stomp/src/emqx_stomp.appup.src @@ -1,8 +1,8 @@ %% -*- mode: erlang -*- {"4.3.1", [{"4.3.0", - [{restart_application,emqx_auth_http}]}, + [{restart_application,emqx_stomp}]}, {<<".*">>,[]}], [{"4.3.0", - [{restart_application,emqx_auth_http}]}, + [{restart_application,emqx_stomp}]}, {<<".*">>,[]}]}. diff --git a/apps/emqx_stomp/src/emqx_stomp_connection.erl b/apps/emqx_stomp/src/emqx_stomp_connection.erl index a75c90c4d..6cf1371e6 100644 --- a/apps/emqx_stomp/src/emqx_stomp_connection.erl +++ b/apps/emqx_stomp/src/emqx_stomp_connection.erl @@ -70,9 +70,13 @@ gc_state :: maybe(emqx_gc:gc_state()), %% Stats Timer stats_timer :: disabled | maybe(reference()), - - await_recv, parser, pstate, - proto_env, heartbeat}). + %% Parser State + parser :: emqx_stomp_frame:parser(), + %% Protocol State + pstate :: emqx_stomp_protocol:pstate(), + %% XXX: some common confs + proto_env :: list() + }). -type(state() :: #state{}). @@ -212,22 +216,6 @@ send(Data, Transport, Sock, ConnPid) -> heartbeat(Transport, Sock) -> Transport:send(Sock, <<$\n>>). -handle_call(info, _From, State = #state{transport = Transport, - socket = Sock, - peername = Peername, - await_recv = AwaitRecv, - sockstate = ConnState, - pstate = PState}) -> - ClientInfo = [{peername, Peername}, {await_recv, AwaitRecv}, - {sockstate, ConnState}], - ProtoInfo = emqx_stomp_protocol:info(PState), - case Transport:getstat(Sock, ?SOCK_STATS) of - {ok, SockStats} -> - {reply, lists:append([ClientInfo, ProtoInfo, SockStats]), State}; - {error, Reason} -> - {stop, Reason, lists:append([ClientInfo, ProtoInfo]), State} - end; - handle_call(discard, _From, State) -> %% TODO: send the DISCONNECT packet? shutdown_and_reply(discared, ok, State); @@ -283,9 +271,6 @@ handle_info({timeout, _TRef, emit_stats}, handle_info({timeout, TRef, TMsg}, State) -> with_proto(timeout, [TRef, TMsg], State); -handle_info({'EXIT', HbProc, Error}, State = #state{heartbeat = HbProc}) -> - stop(Error, State); - handle_info(activate_socket, State = #state{sockstate = OldSst}) -> case activate_socket(State) of {ok, NState = #state{sockstate = NewSst}} ->