summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/rabbit.hrl6
-rw-r--r--src/rabbit_misc.erl4
-rw-r--r--src/rabbit_net.erl5
-rw-r--r--src/rabbit_networking.erl11
4 files changed, 11 insertions, 15 deletions
diff --git a/include/rabbit.hrl b/include/rabbit.hrl
index 06297c69f3..8b87dd9619 100644
--- a/include/rabbit.hrl
+++ b/include/rabbit.hrl
@@ -81,7 +81,7 @@
-type(erlang_node() :: atom()).
-type(node_type() :: disc_only | disc | ram | unknown).
-type(ssl_socket() :: #ssl_socket{}).
--type(socket() :: port() | ssl_socket()).
+-type(socket() :: inet:ip_port() | ssl_socket()).
-type(thunk(T) :: fun(() -> T)).
-type(info_key() :: atom()).
-type(info() :: {info_key(), any()}).
@@ -164,8 +164,8 @@
-type(listener() ::
#listener{node :: erlang_node(),
protocol :: atom(),
- host :: string() | atom(),
- port :: non_neg_integer()}).
+ host :: inet:hostname(),
+ port :: inet:ip_port()}).
-type(not_found() :: {'error', 'not_found'}).
-type(routing_result() :: 'routed' | 'unroutable' | 'not_delivered').
-type(amqp_error() ::
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 35739dcbdf..146004b158 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -71,8 +71,6 @@
-ifdef(use_specs).
--include_lib("kernel/include/inet.hrl").
-
-type(ok_or_error() :: 'ok' | {'error', any()}).
-spec(method_record_type/1 :: (tuple()) -> atom()).
@@ -114,7 +112,7 @@
-spec(makenode/1 :: ({string(), string()} | string()) -> erlang_node()).
-spec(nodeparts/1 :: (erlang_node() | string()) -> {string(), string()}).
-spec(cookie_hash/0 :: () -> string()).
--spec(tcp_name/3 :: (atom(), ip_address(), ip_port()) -> atom()).
+-spec(tcp_name/3 :: (atom(), inet:ip_address(), inet:ip_port()) -> atom()).
-spec(intersperse/2 :: (A, [A]) -> [A]).
-spec(upmap/2 :: (fun ((A) -> B), [A]) -> [B]).
-spec(map_in_order/2 :: (fun ((A) -> B), [A]) -> [B]).
diff --git a/src/rabbit_net.erl b/src/rabbit_net.erl
index 975954fcd2..9abd3ddb5d 100644
--- a/src/rabbit_net.erl
+++ b/src/rabbit_net.erl
@@ -31,7 +31,6 @@
-module(rabbit_net).
-include("rabbit.hrl").
--include_lib("kernel/include/inet.hrl").
-export([async_recv/3, close/1, controlling_process/2,
getstat/2, peername/1, port_command/2,
@@ -51,9 +50,9 @@
-spec(port_command/2 :: (socket(), iolist()) -> 'true').
-spec(send/2 :: (socket(), binary() | iolist()) -> 'ok' | error()).
-spec(peername/1 :: (socket()) ->
- {'ok', {ip_address(), non_neg_integer()}} | error()).
+ {'ok', {inet:ip_address(), inet:ip_port()}} | error()).
-spec(sockname/1 :: (socket()) ->
- {'ok', {ip_address(), non_neg_integer()}} | error()).
+ {'ok', {inet:ip_address(), inet:ip_port()}} | error()).
-spec(getstat/2 :: (socket(), [stat_option()]) ->
{'ok', [{stat_option(), integer()}]} | error()).
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl
index 68ffc98ad7..d00b6062d2 100644
--- a/src/rabbit_networking.erl
+++ b/src/rabbit_networking.erl
@@ -63,13 +63,12 @@
-ifdef(use_specs).
--type(host() :: ip_address() | string() | atom()).
-type(connection() :: pid()).
-spec(start/0 :: () -> 'ok').
--spec(start_tcp_listener/2 :: (host(), ip_port()) -> 'ok').
--spec(start_ssl_listener/3 :: (host(), ip_port(), [info()]) -> 'ok').
--spec(stop_tcp_listener/2 :: (host(), ip_port()) -> 'ok').
+-spec(start_tcp_listener/2 :: (inet:hostname(), inet:ip_port()) -> 'ok').
+-spec(start_ssl_listener/3 :: (inet:hostname(), inet:ip_port(), [info()]) -> 'ok').
+-spec(stop_tcp_listener/2 :: (inet:hostname(), inet:ip_port()) -> 'ok').
-spec(active_listeners/0 :: () -> [listener()]).
-spec(node_listeners/1 :: (erlang_node()) -> [listener()]).
-spec(connections/0 :: () -> [connection()]).
@@ -80,8 +79,8 @@
-spec(connection_info_all/1 :: ([info_key()]) -> [[info()]]).
-spec(close_connection/2 :: (pid(), string()) -> 'ok').
-spec(on_node_down/1 :: (erlang_node()) -> 'ok').
--spec(check_tcp_listener_address/3 :: (atom(), host(), ip_port()) ->
- {ip_address(), atom()}).
+-spec(check_tcp_listener_address/3 :: (atom(), inet:hostname(), inet:ip_port()) ->
+ {inet:ip_address(), atom()}).
-endif.