Skip to content

Commit

Permalink
Add guard to reject {spawn_opt, false} as transport/service_opt()
Browse files Browse the repository at this point in the history
It was possible to configure the option, but doing so caused the service
to fail when starting a watchdog process:

   {function_clause,
       [{diameter_service,'-spawn_opts/1-lc$^0/1-0-',
            [false],
            [{file,"base/diameter_service.erl"},{line,846}]},
        {diameter_service,start,5,
            [{file,"base/diameter_service.erl"},{line,820}]},
        {diameter_service,start,3,
            [{file,"base/diameter_service.erl"},{line,782}]},
        {diameter_service,handle_call,3,
            [{file,"base/diameter_service.erl"},{line,385}]},
        {gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,607}]},
        {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,639}]},
        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}

Tests for the option in the config suite were also missing.

Bungled in commit 78b3dc6.
  • Loading branch information
Anders Svensson committed Mar 26, 2015
1 parent a48186e commit aaff5f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/diameter/src/base/diameter_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,11 @@ opt(spawn_opt, L)
L;

opt(K, false = B)
when K /= sequence ->
when K == share_peers;
K == use_shared_peers;
K == monitor;
K == restrict_connections;
K == string_decode ->
B;

opt(K, true = B)
Expand Down
6 changes: 6 additions & 0 deletions lib/diameter/test/diameter_config_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
{string_decode,
[[true], [false]],
[[0], [x]]},
{spawn_opt,
[[[]], [[monitor, link]]],
[[false]]},
{invalid_option, %% invalid service options are rejected
[],
[[x],
Expand Down Expand Up @@ -186,6 +189,9 @@
{private,
[[x]],
[]},
{spawn_opt,
[[[]], [[monitor, link]]],
[[false]]},
{invalid_option, %% invalid transport options are silently ignored
[[x],
[x,x]],
Expand Down

0 comments on commit aaff5f3

Please sign in to comment.