aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch_tcp.erl
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 /src/ranch_tcp.erl
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 'src/ranch_tcp.erl')
-rw-r--r--src/ranch_tcp.erl20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ranch_tcp.erl b/src/ranch_tcp.erl
index 3b4e4c3..0d8da2e 100644
--- a/src/ranch_tcp.erl
+++ b/src/ranch_tcp.erl
@@ -21,7 +21,11 @@
-export([listen/1]).
-export([disallowed_listen_options/0]).
-export([accept/2]).
+-export([handshake/2]).
-export([handshake/3]).
+-export([handshake_continue/2]).
+-export([handshake_continue/3]).
+-export([handshake_cancel/1]).
-export([connect/3]).
-export([connect/4]).
-export([recv/3]).
@@ -105,10 +109,26 @@ disallowed_listen_options() ->
accept(LSocket, Timeout) ->
gen_tcp:accept(LSocket, Timeout).
+-spec handshake(inet:socket(), timeout()) -> {ok, inet:socket()}.
+handshake(CSocket, Timeout) ->
+ handshake(CSocket, [], Timeout).
+
-spec handshake(inet:socket(), opts(), timeout()) -> {ok, inet:socket()}.
handshake(CSocket, _, _) ->
{ok, CSocket}.
+-spec handshake_continue(inet:socket(), timeout()) -> no_return().
+handshake_continue(CSocket, Timeout) ->
+ handshake_continue(CSocket, [], Timeout).
+
+-spec handshake_continue(inet:socket(), opts(), timeout()) -> no_return().
+handshake_continue(_, _, _) ->
+ error(not_supported).
+
+-spec handshake_cancel(inet:socket()) -> no_return().
+handshake_cancel(_) ->
+ error(not_supported).
+
%% @todo Probably filter Opts?
-spec connect(inet:ip_address() | inet:hostname(),
inet:port_number(), any())