Permalink
Browse files

Simplify init

  • Loading branch information...
1 parent daa2509 commit c58d0d1fe481d4f318e35712a011576b75d16f46 @msantos committed Nov 2, 2010
Showing with 10 additions and 11 deletions.
  1. +10 −11 seds/src/seds.erl
View
@@ -62,18 +62,17 @@ start_link() ->
start_link(Port) ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [Port], []).
+init([Port]) when Port > 1024 ->
+ init(Port, []);
init([Port]) ->
- Opt = case Port of
- N when N > 1024 ->
- [];
- _ ->
- {ok, FD} = procket:listen(Port, [
- {protocol, udp},
- {family, inet},
- {type, dgram}
- ]),
- [{fd, FD}]
- end,
+ {ok, FD} = procket:listen(Port, [
+ {protocol, udp},
+ {family, inet},
+ {type, dgram}
+ ]),
+ init(Port, [{fd, FD}]).
+
+init(Port, Opt) ->
{ok, Socket} = gen_udp:open(Port, [
binary,
{active, once}

0 comments on commit c58d0d1

Please sign in to comment.