aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/ranch.handshake.asciidoc
diff options
context:
space:
mode:
authorjuhlig <[email protected]>2019-09-17 17:55:25 +0200
committerLoïc Hoguin <[email protected]>2019-10-14 12:38:29 +0200
commitd44e7a16f7d2823cc658e39b5d953ba0850e47ba (patch)
tree72ddf6100e12fa7424067262ee31b1f99ce05fff /doc/src/manual/ranch.handshake.asciidoc
parent1db8290685e9cff3dfafde62de6148246075990a (diff)
downloadranch-d44e7a16f7d2823cc658e39b5d953ba0850e47ba.tar.gz
ranch-d44e7a16f7d2823cc658e39b5d953ba0850e47ba.tar.bz2
ranch-d44e7a16f7d2823cc658e39b5d953ba0850e47ba.zip
Enable multiple steps handshake
Also fix some Protocol:start_link/4 into start_link/3 left over in the documentation.
Diffstat (limited to 'doc/src/manual/ranch.handshake.asciidoc')
-rw-r--r--doc/src/manual/ranch.handshake.asciidoc22
1 files changed, 18 insertions, 4 deletions
diff --git a/doc/src/manual/ranch.handshake.asciidoc b/doc/src/manual/ranch.handshake.asciidoc
index 5d2694c..508abe5 100644
--- a/doc/src/manual/ranch.handshake.asciidoc
+++ b/doc/src/manual/ranch.handshake.asciidoc
@@ -8,12 +8,13 @@ ranch:handshake - Perform the transport handshake
[source,erlang]
----
-handshake(Ref) -> handshake(Ref, [])
-handshake(Ref, Opts) -> {ok, Socket}
+handshake(Ref) -> {ok, Socket} | {continue, Info}
+handshake(Ref, Opts) -> {ok, Socket} | {continue, Info}
Ref :: ranch:ref()
Opts :: any()
Socket :: any()
+Info :: any()
----
Perform the transport handshake.
@@ -38,12 +39,23 @@ Allowed options depend on the transport module.
== Return value
-An `ok` tuple is returned containing the socket for the connection.
+An `ok` tuple is returned containing the socket for the connection
+by default.
+
+Depending on configuration, a `continue` tuple can otherwise
+be returned when the handshake operation is paused. It contains
+data provided by the transport that can be used to inform further
+decisions before resuming the handshake, for example to provide
+new transport options. The handshake can be resumed using
+link:man:ranch:handshake_continue(3)[ranch:handshake_continue(3)]
+or canceled using
+link:man:ranch:handshake_cancel(3)[ranch:handshake_cancel(3)].
This function will trigger an exception when an error occurs.
== Changelog
+* *2.0*: The `continue` tuple can now be returned.
* *1.6*: Function introduced. Replaces `ranch:accept_ack/1`.
== Examples
@@ -51,7 +63,7 @@ This function will trigger an exception when an error occurs.
.Initialize the connection process
[source,erlang]
----
-start_link(Ref, _, Transport, Opts) ->
+start_link(Ref, Transport, Opts) ->
Pid = proc_lib:spawn_link(?MODULE, init,
[Ref, Transport, Opts]),
{ok, Pid}.
@@ -65,6 +77,8 @@ init(Ref, Transport, Opts) ->
== See also
link:man:ranch:start_listener(3)[ranch:start_listener(3)],
+link:man:ranch:handshake_continue(3)[ranch:handshake_continue(3)],
+link:man:ranch:handshake_cancel(3)[ranch:handshake_cancel(3)],
link:man:ranch:recv_proxy_header(3)[ranch:recv_proxy_header(3)],
link:man:ranch:remove_connection(3)[ranch:remove_connection(3)],
link:man:ranch(3)[ranch(3)]