* Fix SSL option parser

* Fix bridge disconnect log formatting

* Set no headers if new headers is undefined
This commit is contained in:
spring2maz 2019-03-16 12:28:57 +01:00 committed by Shawn
parent 29f4faa7dd
commit a72a914fb8
3 changed files with 6 additions and 5 deletions

View File

@ -1672,7 +1672,7 @@ end}.
(Opt, Val, Opts) -> (Opt, Val, Opts) ->
case IsSsl(Opt) of case IsSsl(Opt) of
true -> true ->
SslOpts = Parse(Opt, Val) ++ [proplists:get_value(ssl_opts, Opts, [])], SslOpts = Parse(Opt, Val) ++ proplists:get_value(ssl_opts, Opts, []),
lists:ukeymerge(1, [{ssl_opts, SslOpts}], lists:usort(Opts)); lists:ukeymerge(1, [{ssl_opts, SslOpts}], lists:usort(Opts));
false -> false ->
[{Opt, Val}|Opts] [{Opt, Val}|Opts]

View File

@ -345,10 +345,10 @@ connected(internal, maybe_send, State) ->
{next_state, connecting, disconnect(NewState)} {next_state, connecting, disconnect(NewState)}
end; end;
connected(info, {disconnected, ConnRef, Reason}, connected(info, {disconnected, ConnRef, Reason},
#{conn_ref := ConnRefCurrent, connection := Conn} = State) -> #{conn_ref := ConnRefCurrent} = State) ->
case ConnRefCurrent =:= ConnRef of case ConnRefCurrent =:= ConnRef of
true -> true ->
?LOG(info, "Bridge ~p diconnected~nreason=~p", [name(), Conn, Reason]), ?LOG(info, "Bridge ~p diconnected~nreason=~p", [name(), Reason]),
{next_state, connecting, {next_state, connecting,
State#{conn_ref := undefined, connection := undefined}}; State#{conn_ref := undefined, connection := undefined}};
false -> false ->

View File

@ -81,11 +81,12 @@ unset_flag(Flag, Msg = #message{flags = Flags}) ->
false -> Msg false -> Msg
end. end.
-spec(set_headers(map(), emqx_types:message()) -> emqx_types:message()). -spec(set_headers(undefined | map(), emqx_types:message()) -> emqx_types:message()).
set_headers(Headers, Msg = #message{headers = undefined}) when is_map(Headers) -> set_headers(Headers, Msg = #message{headers = undefined}) when is_map(Headers) ->
Msg#message{headers = Headers}; Msg#message{headers = Headers};
set_headers(New, Msg = #message{headers = Old}) when is_map(New) -> set_headers(New, Msg = #message{headers = Old}) when is_map(New) ->
Msg#message{headers = maps:merge(Old, New)}. Msg#message{headers = maps:merge(Old, New)};
set_headers(undefined, Msg) -> Msg.
-spec(get_header(term(), emqx_types:message()) -> term()). -spec(get_header(term(), emqx_types:message()) -> term()).
get_header(Hdr, Msg) -> get_header(Hdr, Msg) ->