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

Use gun:info instead of hacks for test socket operations

This commit is contained in:
Loïc Hoguin 2018-09-26 17:17:25 +02:00
parent 4493afbba0
commit 3c8e6cf819
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 21 additions and 12 deletions

View file

@ -42,8 +42,7 @@ idle_timeout_infinity(Config) ->
Port = ranch:get_port(name()),
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
_ = gun:post(ConnPid, "/echo/read_body", [], <<"TEST">>),
%% @todo Gun should have a debug function to retrieve the socket.
Socket = element(11, element(2, sys:get_state(ConnPid))),
#{socket := Socket} = gun:info(ConnPid),
Pid = get_remote_pid_tcp(Socket),
Ref = erlang:monitor(process, Pid),
receive
@ -61,8 +60,7 @@ request_timeout_infinity(Config) ->
}),
Port = ranch:get_port(name()),
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
%% @todo Gun should have a debug function to retrieve the socket.
Socket = element(11, element(2, sys:get_state(ConnPid))),
#{socket := Socket} = gun:info(ConnPid),
Pid = get_remote_pid_tcp(Socket),
Ref = erlang:monitor(process, Pid),
receive