aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ranch.erl')
-rw-r--r--src/ranch.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ranch.erl b/src/ranch.erl
index b6008fa..3f07df7 100644
--- a/src/ranch.erl
+++ b/src/ranch.erl
@@ -19,6 +19,7 @@
-export([stop_listener/1]).
-export([child_spec/6]).
-export([accept_ack/1]).
+-export([get_port/1]).
-export([get_protocol_options/1]).
-export([set_protocol_options/2]).
@@ -88,6 +89,13 @@ child_spec(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts)
accept_ack(ListenerPid) ->
receive {shoot, ListenerPid} -> ok end.
+%% @doc Return the listener's port.
+-spec get_port(any()) -> inet:port_number().
+get_port(Ref) ->
+ ListenerPid = ref_to_listener_pid(Ref),
+ {ok, Port} = ranch_listener:get_port(ListenerPid),
+ Port.
+
%% @doc Return the current protocol options for the given listener.
-spec get_protocol_options(any()) -> any().
get_protocol_options(Ref) ->