aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-09-26 10:43:12 +0200
committerLoïc Hoguin <[email protected]>2019-09-26 10:53:00 +0200
commitd86d55c1f90b37d991e20ad0f1ac37b1e38b36e1 (patch)
tree23a34ec9158d6abfddc6142923535304c02662c1 /test
parentd9a970be90d0105af215531d74809878f9c21338 (diff)
downloadgun-d86d55c1f90b37d991e20ad0f1ac37b1e38b36e1.tar.gz
gun-d86d55c1f90b37d991e20ad0f1ac37b1e38b36e1.tar.bz2
gun-d86d55c1f90b37d991e20ad0f1ac37b1e38b36e1.zip
Add a function to change the connection owner
While at it the gun:info/1 function has been fixed to work even when we are in the not_connected state, and the owner is now also returned.
Diffstat (limited to 'test')
-rw-r--r--test/gun_SUITE.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index a0ecddd..715bec5 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -384,6 +384,20 @@ retry_timeout(_) ->
error(shutdown_too_late)
end.
+set_owner(_) ->
+ doc("The owner of the connection can be changed."),
+ Self = self(),
+ Pid = spawn(fun() ->
+ {ok, ConnPid} = gun:open("localhost", 12345),
+ gun:set_owner(ConnPid, Self),
+ Self ! {conn, ConnPid}
+ end),
+ Ref = monitor(process, Pid),
+ receive {'DOWN', Ref, process, Pid, _} -> ok after 1000 -> error(timeout) end,
+ ConnPid = receive {conn, C} -> C after 1000 -> error(timeout) end,
+ #{owner := Self} = gun:info(ConnPid),
+ gun:close(ConnPid).
+
shutdown_reason(_) ->
doc("The last connection failure must be propagated."),
{ok, Pid} = gun:open("localhost", 12345, #{retry => 0}),