Add the value of attribute socktype in emqx_conn_type table
This commit is contained in:
parent
c8b243ed22
commit
760ac9f2f9
|
@ -62,17 +62,14 @@ start_link(Transport, Socket, Options) ->
|
||||||
info(CPid) when is_pid(CPid) ->
|
info(CPid) when is_pid(CPid) ->
|
||||||
call(CPid, info);
|
call(CPid, info);
|
||||||
|
|
||||||
info(#state{transport = Transport,
|
info(#state{peername = Peername,
|
||||||
socket = Socket,
|
|
||||||
peername = Peername,
|
|
||||||
sockname = Sockname,
|
sockname = Sockname,
|
||||||
conn_state = ConnState,
|
conn_state = ConnState,
|
||||||
active_n = ActiveN,
|
active_n = ActiveN,
|
||||||
rate_limit = RateLimit,
|
rate_limit = RateLimit,
|
||||||
pub_limit = PubLimit,
|
pub_limit = PubLimit,
|
||||||
proto_state = ProtoState}) ->
|
proto_state = ProtoState}) ->
|
||||||
ConnInfo = [{socktype, Transport:type(Socket)},
|
ConnInfo = [{peername, Peername},
|
||||||
{peername, Peername},
|
|
||||||
{sockname, Sockname},
|
{sockname, Sockname},
|
||||||
{conn_state, ConnState},
|
{conn_state, ConnState},
|
||||||
{active_n, ActiveN},
|
{active_n, ActiveN},
|
||||||
|
@ -137,7 +134,8 @@ init([Transport, RawSocket, Options]) ->
|
||||||
ProtoState = emqx_protocol:init(#{peername => Peername,
|
ProtoState = emqx_protocol:init(#{peername => Peername,
|
||||||
sockname => Sockname,
|
sockname => Sockname,
|
||||||
peercert => Peercert,
|
peercert => Peercert,
|
||||||
sendfun => SendFun}, Options),
|
sendfun => SendFun,
|
||||||
|
socktype => Transport:type(Socket)}, Options),
|
||||||
ParserState = emqx_protocol:parser(ProtoState),
|
ParserState = emqx_protocol:parser(ProtoState),
|
||||||
GcPolicy = emqx_zone:get_env(Zone, force_gc_policy, false),
|
GcPolicy = emqx_zone:get_env(Zone, force_gc_policy, false),
|
||||||
GcState = emqx_gc:init(GcPolicy),
|
GcState = emqx_gc:init(GcPolicy),
|
||||||
|
|
|
@ -65,7 +65,8 @@
|
||||||
connected,
|
connected,
|
||||||
connected_at,
|
connected_at,
|
||||||
ignore_loop,
|
ignore_loop,
|
||||||
topic_alias_maximum
|
topic_alias_maximum,
|
||||||
|
socktype
|
||||||
}).
|
}).
|
||||||
|
|
||||||
-opaque(state() :: #pstate{}).
|
-opaque(state() :: #pstate{}).
|
||||||
|
@ -82,7 +83,7 @@
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
-spec(init(map(), list()) -> state()).
|
-spec(init(map(), list()) -> state()).
|
||||||
init(#{peername := Peername, peercert := Peercert, sendfun := SendFun}, Options) ->
|
init(#{peername := Peername, peercert := Peercert, sendfun := SendFun, socktype := SockType}, Options) ->
|
||||||
Zone = proplists:get_value(zone, Options),
|
Zone = proplists:get_value(zone, Options),
|
||||||
#pstate{zone = Zone,
|
#pstate{zone = Zone,
|
||||||
sendfun = SendFun,
|
sendfun = SendFun,
|
||||||
|
@ -107,7 +108,8 @@ init(#{peername := Peername, peercert := Peercert, sendfun := SendFun}, Options)
|
||||||
send_stats = #{msg => 0, pkt => 0},
|
send_stats = #{msg => 0, pkt => 0},
|
||||||
connected = false,
|
connected = false,
|
||||||
ignore_loop = emqx_config:get_env(mqtt_ignore_loop_deliver, false),
|
ignore_loop = emqx_config:get_env(mqtt_ignore_loop_deliver, false),
|
||||||
topic_alias_maximum = #{to_client => 0, from_client => 0}}.
|
topic_alias_maximum = #{to_client => 0, from_client => 0},
|
||||||
|
socktype = SockType}.
|
||||||
|
|
||||||
init_username(Peercert, Options) ->
|
init_username(Peercert, Options) ->
|
||||||
case proplists:get_value(peer_cert_as_username, Options) of
|
case proplists:get_value(peer_cert_as_username, Options) of
|
||||||
|
@ -149,7 +151,8 @@ attrs(#pstate{zone = Zone,
|
||||||
mountpoint = Mountpoint,
|
mountpoint = Mountpoint,
|
||||||
is_super = IsSuper,
|
is_super = IsSuper,
|
||||||
is_bridge = IsBridge,
|
is_bridge = IsBridge,
|
||||||
connected_at = ConnectedAt}) ->
|
connected_at = ConnectedAt,
|
||||||
|
socktype = SockType}) ->
|
||||||
[{zone, Zone},
|
[{zone, Zone},
|
||||||
{client_id, ClientId},
|
{client_id, ClientId},
|
||||||
{username, Username},
|
{username, Username},
|
||||||
|
@ -162,7 +165,8 @@ attrs(#pstate{zone = Zone,
|
||||||
{mountpoint, Mountpoint},
|
{mountpoint, Mountpoint},
|
||||||
{is_super, IsSuper},
|
{is_super, IsSuper},
|
||||||
{is_bridge, IsBridge},
|
{is_bridge, IsBridge},
|
||||||
{connected_at, ConnectedAt}].
|
{connected_at, ConnectedAt},
|
||||||
|
{socktype, SockType}].
|
||||||
|
|
||||||
attr(max_inflight, #pstate{proto_ver = ?MQTT_PROTO_V5, conn_props = ConnProps}) ->
|
attr(max_inflight, #pstate{proto_ver = ?MQTT_PROTO_V5, conn_props = ConnProps}) ->
|
||||||
get_property('Receive-Maximum', ConnProps, 65535);
|
get_property('Receive-Maximum', ConnProps, 65535);
|
||||||
|
|
|
@ -58,11 +58,10 @@ info(#state{peername = Peername,
|
||||||
sockname = Sockname,
|
sockname = Sockname,
|
||||||
proto_state = ProtoState}) ->
|
proto_state = ProtoState}) ->
|
||||||
ProtoInfo = emqx_protocol:info(ProtoState),
|
ProtoInfo = emqx_protocol:info(ProtoState),
|
||||||
ConnInfo = [{socktype, websocket},
|
ConnInfo = [{conn_state, running},
|
||||||
{conn_state, running},
|
|
||||||
{peername, Peername},
|
{peername, Peername},
|
||||||
{sockname, Sockname}],
|
{sockname, Sockname}],
|
||||||
lists:append([ConnInfo, ProtoInfo]).
|
lists:append([ConnInfo, ProtoInfo]).
|
||||||
|
|
||||||
%% for dashboard
|
%% for dashboard
|
||||||
attrs(WSPid) when is_pid(WSPid) ->
|
attrs(WSPid) when is_pid(WSPid) ->
|
||||||
|
@ -127,7 +126,8 @@ websocket_init(#state{request = Req, options = Options}) ->
|
||||||
ProtoState = emqx_protocol:init(#{peername => Peername,
|
ProtoState = emqx_protocol:init(#{peername => Peername,
|
||||||
sockname => Sockname,
|
sockname => Sockname,
|
||||||
peercert => Peercert,
|
peercert => Peercert,
|
||||||
sendfun => send_fun(self())}, Options),
|
sendfun => send_fun(self()),
|
||||||
|
socktype => websocket}, Options),
|
||||||
ParserState = emqx_protocol:parser(ProtoState),
|
ParserState = emqx_protocol:parser(ProtoState),
|
||||||
Zone = proplists:get_value(zone, Options),
|
Zone = proplists:get_value(zone, Options),
|
||||||
EnableStats = emqx_zone:get_env(Zone, enable_stats, true),
|
EnableStats = emqx_zone:get_env(Zone, enable_stats, true),
|
||||||
|
|
Loading…
Reference in New Issue