aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/manual/ranch_transport.asciidoc9
-rw-r--r--src/ranch_ssl.erl2
-rw-r--r--src/ranch_tcp.erl2
-rw-r--r--src/ranch_transport.erl2
-rw-r--r--test/active_echo_protocol.erl2
5 files changed, 10 insertions, 7 deletions
diff --git a/doc/src/manual/ranch_transport.asciidoc b/doc/src/manual/ranch_transport.asciidoc
index 50c0b0a..b7ec6d2 100644
--- a/doc/src/manual/ranch_transport.asciidoc
+++ b/doc/src/manual/ranch_transport.asciidoc
@@ -115,9 +115,10 @@ means a random available port number will be chosen.
[source,erlang]
----
messages()
- -> {OK :: atom(),
- Closed :: atom(),
- Error :: atom()}
+ -> {OK :: atom(),
+ Closed :: atom(),
+ Error :: atom(),
+ Passive :: atom()}
----
Return the tuple keys for the messages sent by the socket.
@@ -284,6 +285,8 @@ The exact type will vary depending on the transport module.
== Changelog
+* *2.0*: The callback `messages/0` return value was updated to
+ include the passive message for `{active, N}`.
* *1.6*: The `socket()` type was added for documentation purposes.
* *1.6*: The type of the sendfile filename was extended.
diff --git a/src/ranch_ssl.erl b/src/ranch_ssl.erl
index 2b246f7..8dc808d 100644
--- a/src/ranch_ssl.erl
+++ b/src/ranch_ssl.erl
@@ -89,7 +89,7 @@ name() -> ssl.
secure() ->
true.
-messages() -> {ssl, ssl_closed, ssl_error}.
+messages() -> {ssl, ssl_closed, ssl_error, ssl_passive}.
-spec listen(opts()) -> {ok, ssl:sslsocket()} | {error, atom()}.
listen(Opts) ->
diff --git a/src/ranch_tcp.erl b/src/ranch_tcp.erl
index 129202d..0fa06d1 100644
--- a/src/ranch_tcp.erl
+++ b/src/ranch_tcp.erl
@@ -76,7 +76,7 @@ name() -> tcp.
secure() ->
false.
-messages() -> {tcp, tcp_closed, tcp_error}.
+messages() -> {tcp, tcp_closed, tcp_error, tcp_passive}.
-spec listen(opts()) -> {ok, inet:socket()} | {error, atom()}.
listen(Opts) ->
diff --git a/src/ranch_transport.erl b/src/ranch_transport.erl
index 486c6d6..c968868 100644
--- a/src/ranch_transport.erl
+++ b/src/ranch_transport.erl
@@ -26,7 +26,7 @@
-callback name() -> atom().
-callback secure() -> boolean().
--callback messages() -> {OK::atom(), Closed::atom(), Error::atom()}.
+-callback messages() -> {OK::atom(), Closed::atom(), Error::atom(), Passive::atom()}.
-callback listen(opts()) -> {ok, socket()} | {error, atom()}.
-callback accept(socket(), timeout())
-> {ok, socket()} | {error, closed | timeout | atom()}.
diff --git a/test/active_echo_protocol.erl b/test/active_echo_protocol.erl
index 3c3ab0d..6ae47a6 100644
--- a/test/active_echo_protocol.erl
+++ b/test/active_echo_protocol.erl
@@ -13,7 +13,7 @@ init(Ref, Transport, _Opts = []) ->
loop(Socket, Transport).
loop(Socket, Transport) ->
- {OK, Closed, Error} = Transport:messages(),
+ {OK, Closed, Error, _Passive} = Transport:messages(),
Transport:setopts(Socket, [{active, once}]),
receive
{OK, Socket, Data} ->