aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2021-02-09 14:36:39 +0100
committerLoïc Hoguin <[email protected]>2021-02-09 14:36:39 +0100
commit52b989079bacf423818a8e6d42c56095ad857635 (patch)
tree5a661c7b7953035d662e93c26c18eacbd9bca2db /src
parent53205a26d9cbbc09b9b31cf7005293ac9d99eaae (diff)
downloadgun-52b989079bacf423818a8e6d42c56095ad857635.tar.gz
gun-52b989079bacf423818a8e6d42c56095ad857635.tar.bz2
gun-52b989079bacf423818a8e6d42c56095ad857635.zip
Fix gun_pool:stop_pool/2,3 with default port
Diffstat (limited to 'src')
-rw-r--r--src/gun_pool.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gun_pool.erl b/src/gun_pool.erl
index da31a42..8c40788 100644
--- a/src/gun_pool.erl
+++ b/src/gun_pool.erl
@@ -165,10 +165,17 @@ start_pool(Host, Port, Opts) ->
stop_pool(Host, Port) ->
stop_pool(Host, Port, #{}).
--spec stop_pool(inet:hostname() | inet:ip_address(), inet:port_number(), req_opts())
+-type stop_opts() :: #{
+ scope => any(),
+ transport => tcp | tls
+}.
+
+-spec stop_pool(inet:hostname() | inet:ip_address(), inet:port_number(), stop_opts())
-> ok | {error, pool_not_found, atom()}.
-stop_pool(Host, Port, ReqOpts) ->
- case get_pool(iolist_to_binary([Host, $:, integer_to_binary(Port)]), ReqOpts) of
+stop_pool(Host, Port, StopOpts) ->
+ Transport = maps:get(transport, StopOpts, gun:default_transport(Port)),
+ Authority = gun_http:host_header(Transport, Host, Port),
+ case get_pool(Authority, StopOpts) of
undefined ->
{error, pool_not_found,
'No pool was found for the given scope and authority.'};