Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Experimental patch to enable listening on both ip4 and ip6.
  • Loading branch information
mworrell committed Apr 3, 2010
1 parent 129cdc6 commit 46a23fa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/mochiweb_socket_server.erl
Expand Up @@ -72,6 +72,8 @@ parse_options([{ip, Ip} | Rest], State) ->
ParsedIp = case Ip of
any ->
any;
any6 ->
any6;
Ip when is_tuple(Ip) ->
Ip;
Ip when is_list(Ip) ->
Expand Down Expand Up @@ -130,9 +132,11 @@ init(State=#mochiweb_socket_server{ip=Ip, port=Port, backlog=Backlog}) ->
{active, false},
{nodelay, true}],
Opts = case Ip of
any ->
case ipv6_supported() of % IPv4, and IPv6 if supported
true -> [inet, inet6 | BaseOpts];
any ->
[inet | BaseOpts];
any6 ->
case ipv6_supported() of % IPv6 if supported
true -> [inet6 | BaseOpts];
_ -> BaseOpts
end;
{_, _, _, _} -> % IPv4
Expand Down

0 comments on commit 46a23fa

Please sign in to comment.