ranch:handshake_cancel(3)

NAME

ranch:handshake_cancel - Cancel the paused transport handshake

DESCRIPTION
    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
    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

ranch:handshake(3), ranch:handshake_continue(3), ranch(3)