Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simplify init

  • Loading branch information...
commit b270c9a8a583d96503a2dcf02daf34813ecd9964 1 parent 2de53be
@msantos authored
Showing with 10 additions and 11 deletions.
  1. +10 −11 src/seds.erl
View
21 src/seds.erl
@@ -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}
Please sign in to comment.
Something went wrong with that request. Please try again.