diff options
author | j.uhlig <[email protected]> | 2018-06-26 17:07:13 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-07-02 09:02:00 +0200 |
commit | 5ada450fe10a5fc51b7f3f0900571a10547635a1 (patch) | |
tree | 45ac84215485f09ebedce319121ed5f719b30493 /src/ranch.erl | |
parent | caeadc82615e9e5ce0c2d92f882cad7b9cb7322d (diff) | |
download | ranch-5ada450fe10a5fc51b7f3f0900571a10547635a1.tar.gz ranch-5ada450fe10a5fc51b7f3f0900571a10547635a1.tar.bz2 ranch-5ada450fe10a5fc51b7f3f0900571a10547635a1.zip |
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.
Diffstat (limited to 'src/ranch.erl')
-rw-r--r-- | src/ranch.erl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ranch.erl b/src/ranch.erl index 9cd3809..287b1e3 100644 --- a/src/ranch.erl +++ b/src/ranch.erl @@ -22,6 +22,8 @@ -export([child_spec/5]). -export([child_spec/6]). -export([accept_ack/1]). +-export([handshake/1]). +-export([handshake/2]). -export([remove_connection/1]). -export([get_status/1]). -export([get_addr/1]). @@ -166,10 +168,20 @@ child_spec(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -spec accept_ack(ref()) -> ok. accept_ack(Ref) -> - receive {shoot, Ref, Transport, Socket, AckTimeout} -> + receive {handshake, Ref, Transport, Socket, AckTimeout} -> Transport:accept_ack(Socket, AckTimeout) end. +-spec handshake(ref()) -> {ok, ranch_transport:socket()}. +handshake(Ref) -> + handshake(Ref, []). + +-spec handshake(ref(), any()) -> {ok, ranch_transport:socket()}. +handshake(Ref, Opts) -> + receive {handshake, Ref, Transport, Socket, AckTimeout} -> + Transport:handshake(Socket, Opts, AckTimeout) + end. + -spec remove_connection(ref()) -> ok. remove_connection(Ref) -> ConnsSup = ranch_server:get_connections_sup(Ref), |