0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Improve the detection of localhost interfaces for the HTTP test suite

This commit is contained in:
Ali Sabil 2013-06-10 09:53:32 +02:00
parent fdd67b72a3
commit 809dc32339

View file

@ -422,9 +422,9 @@ body_to_chunks(ChunkSize, Body, Acc) ->
get_mtu() ->
{ok, Interfaces} = inet:getiflist(),
[LocalInterface | _] = lists:filter(fun
("lo" ++ _) -> true;
(_) -> false
[LocalInterface | _ ] = lists:filter(fun(Interface) ->
{ok, [{flags, Flags}]} = inet:ifget(Interface, [flags]),
lists:member(loopback, Flags)
end, Interfaces),
{ok, [{mtu, MTU}]} = inet:ifget(LocalInterface, [mtu]),
MTU.