aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/ranch.handshake_cancel.asciidoc
blob: 6f742f503573582d7bbf6d43091f7e79c402f5cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
= ranch:handshake_cancel(3)

== Name

ranch:handshake_cancel - Cancel the paused transport handshake

== Description

[source,erlang]
----
handshake_cancel(Ref :: ranch:ref()) -> ok
----

Cancel the paused transport handshake.

This function may be called by the protocol process
to cancel a paused handshake.

== Arguments

Ref::

The listener name.
+
Allowed options depend on the transport module.

== Return value

The return value depends on the transport module.

== Changelog

* *2.0*: Function introduced.

== Examples

.Cancel a paused transport handshake
[source,erlang]
----
start_link(Ref, Transport, Opts) ->
    Pid = proc_lib:spawn_link(?MODULE, init,
        [Ref, Transport, Opts]),
    {ok, Pid}.

init(Ref, Transport, Opts) ->
    {continue, _Info} = ranch:handshake(Ref),
    ranch:handshake_cancel(Ref),
    exit(handshake_cancelled).
----

== See also

link:man:ranch:handshake(3)[ranch:handshake(3)],
link:man:ranch:handshake_continue(3)[ranch:handshake_continue(3)],
link:man:ranch(3)[ranch(3)]