Merge pull request #12525 from zmstone/0216-docs-add-ref-to-bridge_mode
docs: add a reference to the origin of is_bridge and bridge_mode
This commit is contained in:
commit
9ffda0187f
|
@ -1551,6 +1551,8 @@ set_username(
|
||||||
set_username(_ConnPkt, ClientInfo) ->
|
set_username(_ConnPkt, ClientInfo) ->
|
||||||
{ok, ClientInfo}.
|
{ok, ClientInfo}.
|
||||||
|
|
||||||
|
%% The `is_bridge` bit flag in CONNECT packet (parsed as `bridge_mode`)
|
||||||
|
%% is invented by mosquitto, named 'try_private': https://mosquitto.org/man/mosquitto-conf-5.html
|
||||||
set_bridge_mode(#mqtt_packet_connect{is_bridge = true}, ClientInfo) ->
|
set_bridge_mode(#mqtt_packet_connect{is_bridge = true}, ClientInfo) ->
|
||||||
{ok, ClientInfo#{is_bridge => true}};
|
{ok, ClientInfo#{is_bridge => true}};
|
||||||
set_bridge_mode(_ConnPkt, _ClientInfo) ->
|
set_bridge_mode(_ConnPkt, _ClientInfo) ->
|
||||||
|
|
|
@ -675,9 +675,19 @@ merge_to_override_config(RawConf, Opts) ->
|
||||||
maps:merge(UpgradedOldConf, RawConf).
|
maps:merge(UpgradedOldConf, RawConf).
|
||||||
|
|
||||||
upgrade_conf(Conf) ->
|
upgrade_conf(Conf) ->
|
||||||
|
ConfigLoader = emqx_app:get_config_loader(),
|
||||||
|
%% ensure module loaded
|
||||||
|
_ = ConfigLoader:module_info(),
|
||||||
|
case erlang:function_exported(ConfigLoader, schema_module, 0) of
|
||||||
|
true ->
|
||||||
|
try_upgrade_conf(apply(ConfigLoader, schema_module, []), Conf);
|
||||||
|
false ->
|
||||||
|
%% this happens during emqx app standalone test
|
||||||
|
Conf
|
||||||
|
end.
|
||||||
|
|
||||||
|
try_upgrade_conf(SchemaModule, Conf) ->
|
||||||
try
|
try
|
||||||
ConfLoader = emqx_app:get_config_loader(),
|
|
||||||
SchemaModule = apply(ConfLoader, schema_module, []),
|
|
||||||
apply(SchemaModule, upgrade_raw_conf, [Conf])
|
apply(SchemaModule, upgrade_raw_conf, [Conf])
|
||||||
catch
|
catch
|
||||||
ErrorType:Reason:Stack ->
|
ErrorType:Reason:Stack ->
|
||||||
|
|
|
@ -301,6 +301,7 @@ parse_connect2(
|
||||||
proto_name = ProtoName,
|
proto_name = ProtoName,
|
||||||
proto_ver = ProtoVer,
|
proto_ver = ProtoVer,
|
||||||
%% For bridge mode, non-standard implementation
|
%% For bridge mode, non-standard implementation
|
||||||
|
%% Invented by mosquitto, named 'try_private': https://mosquitto.org/man/mosquitto-conf-5.html
|
||||||
is_bridge = (BridgeTag =:= 8),
|
is_bridge = (BridgeTag =:= 8),
|
||||||
clean_start = bool(CleanStart),
|
clean_start = bool(CleanStart),
|
||||||
will_flag = bool(WillFlag),
|
will_flag = bool(WillFlag),
|
||||||
|
@ -772,6 +773,7 @@ serialize_variable(
|
||||||
proto_name = ProtoName,
|
proto_name = ProtoName,
|
||||||
proto_ver = ProtoVer,
|
proto_ver = ProtoVer,
|
||||||
%% For bridge mode, non-standard implementation
|
%% For bridge mode, non-standard implementation
|
||||||
|
%% Invented by mosquitto, named 'try_private': https://mosquitto.org/man/mosquitto-conf-5.html
|
||||||
is_bridge = IsBridge,
|
is_bridge = IsBridge,
|
||||||
clean_start = CleanStart,
|
clean_start = CleanStart,
|
||||||
will_flag = WillFlag,
|
will_flag = WillFlag,
|
||||||
|
|
Loading…
Reference in New Issue