From 5ada450fe10a5fc51b7f3f0900571a10547635a1 Mon Sep 17 00:00:00 2001 From: "j.uhlig" Date: Tue, 26 Jun 2018 17:07:13 +0200 Subject: Introduce Transport:handshake/1,2 This commit deprecates Transport:accept_ack/1 in favor of a new forward-compatible function. Transport:handshake/1,2 will use ssl:handshake/2,3 from Ranch 2.0 onward. --- doc/src/manual/ranch_transport.asciidoc | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'doc/src/manual/ranch_transport.asciidoc') diff --git a/doc/src/manual/ranch_transport.asciidoc b/doc/src/manual/ranch_transport.asciidoc index cbcea42..ed0ad70 100644 --- a/doc/src/manual/ranch_transport.asciidoc +++ b/doc/src/manual/ranch_transport.asciidoc @@ -26,22 +26,10 @@ Timeout = timeout():: Accept timeout. Accept a connection on the given listening socket. -The `accept_ack` callback will be used to initialize the socket +The `handshake` callback will be used to initialize the socket after accepting the connection. This is most useful when the transport is not raw TCP, like with SSL for example. -=== accept_ack(CSocket, Timeout) -> ok - -CSocket = any():: Socket for this connection. -Timeout = timeout():: Ack timeout. - -Perform post-accept initialization of the connection. - -This function will be called by connection processes -before performing any socket operation. It allows -transports that require extra initialization to perform -their task and make the socket ready to use. - === close(Socket) -> ok Socket = any():: Socket opened with listen/1 or accept/2. @@ -60,6 +48,20 @@ perform operations on the socket, and that will receive messages from the socket when active mode is used. When the controlling process dies, the socket is closed. +=== handshake(CSocket0, Options, Timeout) -> {ok, CSocket1} + +CSocket0 = any():: Uninitialized socket for this connection. +Options = any():: Options for initialization. +Timeout = timeout():: Handshake timeout. +CSocket1 = any():: Initialized socket for this connection. + +Perform post-accept initialization of the connection. + +This function will be called by connection processes +before performing any socket operation. It allows +transports that require extra initialization to perform +their task and return a socket that is ready to use. + === listen(TransOpts) -> {ok, LSocket} | {error, atom()} TransOpts = any():: Transport options. -- cgit v1.2.3