aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch.erl
diff options
context:
space:
mode:
authorjuhlig <[email protected]>2019-05-14 11:27:04 +0200
committerLoïc Hoguin <[email protected]>2019-05-18 21:50:44 +0200
commitb1e6406e4f0871c656f92fdd0755c8ef82be2818 (patch)
treeb628d0e65859384d8cbc7315d96cfdbb22f8b742 /src/ranch.erl
parentc7dcc9cb1362e397d8d3d184b0643f2ca50c032e (diff)
downloadranch-b1e6406e4f0871c656f92fdd0755c8ef82be2818.tar.gz
ranch-b1e6406e4f0871c656f92fdd0755c8ef82be2818.tar.bz2
ranch-b1e6406e4f0871c656f92fdd0755c8ef82be2818.zip
Add support for UNIX domain sockets
It was working already but the types were wrong and some small details needed to be corrected.
Diffstat (limited to 'src/ranch.erl')
-rw-r--r--src/ranch.erl18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ranch.erl b/src/ranch.erl
index a0fdea6..86a1c30 100644
--- a/src/ranch.erl
+++ b/src/ranch.erl
@@ -201,14 +201,19 @@ get_status(Ref) ->
running
end.
--spec get_addr(ref()) -> {inet:ip_address(), inet:port_number()} | {undefined, undefined}.
+-spec get_addr(ref()) -> {inet:ip_address(), inet:port_number()} |
+ {local, binary()} | {undefined, undefined}.
get_addr(Ref) ->
ranch_server:get_addr(Ref).
-spec get_port(ref()) -> inet:port_number() | undefined.
get_port(Ref) ->
- {_, Port} = get_addr(Ref),
- Port.
+ case get_addr(Ref) of
+ {local, _} ->
+ undefined;
+ {_, Port} ->
+ Port
+ end.
-spec get_connections(ref(), active|all) -> non_neg_integer().
get_connections(Ref, active) ->
@@ -263,7 +268,12 @@ info(Ref) ->
listener_info(Ref, Pid) ->
[_, Transport, _, Protocol, _] = ranch_server:get_listener_start_args(Ref),
Status = get_status(Ref),
- {IP, Port} = get_addr(Ref),
+ {IP, Port} = case get_addr(Ref) of
+ Addr = {local, _} ->
+ {Addr, undefined};
+ Addr ->
+ Addr
+ end,
MaxConns = get_max_connections(Ref),
TransOpts = ranch_server:get_transport_options(Ref),
ProtoOpts = get_protocol_options(Ref),