fix(exproto): keep conn_mod attribute in ConnInfo

This commit is contained in:
JianBo He 2022-04-01 14:08:30 +08:00
parent 59d5478d4e
commit ff2022d9a0
3 changed files with 9 additions and 6 deletions

View File

@ -177,6 +177,8 @@ subscriptions(get, #{
ClientId = emqx_mgmt_util:urldecode(ClientId0),
with_gateway(Name0, fun(GwName, _) ->
case emqx_gateway_http:list_client_subscriptions(GwName, ClientId) of
{error, not_found} ->
return_http_error(404, "client process not found");
{error, Reason} ->
return_http_error(500, Reason);
{ok, Subs} ->
@ -202,8 +204,10 @@ subscriptions(post, #{
GwName, ClientId, Topic, SubOpts
)
of
{error, not_found} ->
return_http_error(404, "client process not found");
{error, Reason} ->
return_http_error(404, Reason);
return_http_error(500, Reason);
{ok, {NTopic, NSubOpts}} ->
{201, maps:merge(NSubOpts, #{topic => NTopic})}
end

View File

@ -694,17 +694,17 @@ call(GwName, ClientId, Req, Timeout) ->
do_call(GwName, ClientId, ChanPid, Req) ->
case do_get_chann_conn_mod(GwName, ClientId, ChanPid) of
undefined -> throw(noproc);
undefined -> undefined;
ConnMod -> ConnMod:call(ChanPid, Req)
end.
do_call(GwName, ClientId, ChanPid, Req, Timeout) ->
case do_get_chann_conn_mod(GwName, ClientId, ChanPid) of
undefined -> throw(noproc);
undefined -> undefined;
ConnMod -> ConnMod:call(ChanPid, Req, Timeout)
end.
-spec cast(gateway_name(), emqx_types:clientid(), term()) -> ok.
-spec cast(gateway_name(), emqx_types:clientid(), term()) -> undefined | ok.
cast(GwName, ClientId, Req) ->
with_channel(
GwName,
@ -719,7 +719,7 @@ cast(GwName, ClientId, Req) ->
do_cast(GwName, ClientId, ChanPid, Req) ->
case do_get_chann_conn_mod(GwName, ClientId, ChanPid) of
undefined -> throw(noproc);
undefined -> undefined;
ConnMod -> ConnMod:cast(ChanPid, Req)
end.

View File

@ -722,7 +722,6 @@ default_conninfo(ConnInfo) ->
clean_start => true,
clientid => undefined,
username => undefined,
conn_mod => undefined,
conn_props => #{},
connected => true,
proto_name => <<"exproto">>,