From 52b989079bacf423818a8e6d42c56095ad857635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 9 Feb 2021 14:36:39 +0100 Subject: Fix gun_pool:stop_pool/2,3 with default port --- src/gun_pool.erl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') 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.'}; -- cgit v1.2.3