From 36827df3e20dd006d997da89401b1435dafb5120 Mon Sep 17 00:00:00 2001 From: firest Date: Tue, 21 Nov 2023 18:27:40 +0800 Subject: [PATCH] fix: allow using boolean to set the switch option --- src/erlfdb_nif.erl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/erlfdb_nif.erl b/src/erlfdb_nif.erl index 125b077..4d1c406 100644 --- a/src/erlfdb_nif.erl +++ b/src/erlfdb_nif.erl @@ -479,13 +479,15 @@ init() -> end, lists:foreach( - fun(Option) -> - case Option of - Name when is_atom(Name) -> - ok = network_set_option(Name, <<>>); - {Name, Value} when is_atom(Name) -> - ok = network_set_option(Name, Value) - end + fun + (Name) when is_atom(Name) -> + ok = network_set_option(Name, <<>>); + ({Name, true}) when is_atom(Name) -> + ok = network_set_option(Name, <<>>); + ({_Name, false}) -> + ok; + ({Name, Value}) when is_atom(Name) -> + ok = network_set_option(Name, Value) end, Opts ),