aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-08-22 14:03:50 +0200
committerLoïc Hoguin <[email protected]>2015-08-22 14:03:50 +0200
commit309f8bacf62efa1bcf6b85bfabc7ae45b6544b79 (patch)
tree42fc68e91e2519b79373da6c7cdebb966bb3b1f5 /src
parentc9da21c7aae3fa1d8032791db8be619668f3357b (diff)
downloadranch-309f8bacf62efa1bcf6b85bfabc7ae45b6544b79.tar.gz
ranch-309f8bacf62efa1bcf6b85bfabc7ae45b6544b79.tar.bz2
ranch-309f8bacf62efa1bcf6b85bfabc7ae45b6544b79.zip
Print a warning when discarding an option on listener startup
Diffstat (limited to 'src')
-rw-r--r--src/ranch.erl18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/ranch.erl b/src/ranch.erl
index 9f764d3..769447a 100644
--- a/src/ranch.erl
+++ b/src/ranch.erl
@@ -134,8 +134,11 @@ filter_options(UserOptions, AllowedKeys, DefaultOptions) ->
%% 2-tuple options.
filter_user_options([Opt = {Key, _}|Tail], AllowedKeys) ->
case lists:member(Key, AllowedKeys) of
- true -> [Opt|filter_user_options(Tail, AllowedKeys)];
- false -> filter_user_options(Tail, AllowedKeys)
+ true ->
+ [Opt|filter_user_options(Tail, AllowedKeys)];
+ false ->
+ filter_options_warning(Opt),
+ filter_user_options(Tail, AllowedKeys)
end;
%% Special option forms.
filter_user_options([inet|Tail], AllowedKeys) ->
@@ -143,15 +146,16 @@ filter_user_options([inet|Tail], AllowedKeys) ->
filter_user_options([inet6|Tail], AllowedKeys) ->
[inet6|filter_user_options(Tail, AllowedKeys)];
filter_user_options([Opt = {raw, _, _, _}|Tail], AllowedKeys) ->
- case lists:member(raw, AllowedKeys) of
- true -> [Opt|filter_user_options(Tail, AllowedKeys)];
- false -> filter_user_options(Tail, AllowedKeys)
- end;
-filter_user_options([_|Tail], AllowedKeys) ->
+ [Opt|filter_user_options(Tail, AllowedKeys)];
+filter_user_options([Opt|Tail], AllowedKeys) ->
+ filter_options_warning(Opt),
filter_user_options(Tail, AllowedKeys);
filter_user_options([], _) ->
[].
+filter_options_warning(Opt) ->
+ error_logger:warning_msg("Transport option ~p unknown or invalid.~n", [Opt]).
+
merge_options({Key, _} = Option, OptionList) ->
lists:keystore(Key, 1, OptionList, Option);
merge_options(Option, OptionList) ->