diff options
author | j.uhlig <[email protected]> | 2018-04-09 12:53:02 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-05-02 17:21:11 +0200 |
commit | 7006c50c3ed6c3cbcb24e9e88a76ebd1aaf3a5f8 (patch) | |
tree | 4f34510579b6bff962e1906925b951504217f137 /doc/src/manual/ranch.asciidoc | |
parent | e2d8d737677f464bd18a10b630417b770caa01cc (diff) | |
download | ranch-7006c50c3ed6c3cbcb24e9e88a76ebd1aaf3a5f8.tar.gz ranch-7006c50c3ed6c3cbcb24e9e88a76ebd1aaf3a5f8.tar.bz2 ranch-7006c50c3ed6c3cbcb24e9e88a76ebd1aaf3a5f8.zip |
Add suspend/resume of listeners and update of transport options
This allows graceful draining of connections, updating transport
options on a running listener without having to drop connections
and other similar scenarios.
Note that when updating transport options the listener must be
suspended which means that new connections will be rejected until
the listener is resumed.
Diffstat (limited to 'doc/src/manual/ranch.asciidoc')
-rw-r--r-- | doc/src/manual/ranch.asciidoc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/doc/src/manual/ranch.asciidoc b/doc/src/manual/ranch.asciidoc index e0244c8..b442f88 100644 --- a/doc/src/manual/ranch.asciidoc +++ b/doc/src/manual/ranch.asciidoc @@ -114,6 +114,19 @@ ProtoOpts = any():: Current protocol options. Return the protocol options set for the given listener. +=== get_status(Ref) -> running | suspended + +Ref = ref():: Listener name. + +Return the status of the given listener. + +=== get_transport_options(Ref) -> ProtoOpts + +Ref = ref():: Listener name. +TransOpts = any():: Current transport options. + +Return the transport options set for the given listener. + === info() -> [{Ref, [{Key, Value}]}] Ref = ref():: Listener name. @@ -155,6 +168,16 @@ without sacrificing the latency of the system. This function may only be called from a connection process. +=== resume_listener(Ref) -> ok + +Ref = ref():: Listener name. + +Resume the given listener if it is suspended. +If the listener is already running, nothing will happen. + +The listener will be started with the transport options +currently set for it. + === set_max_connections(Ref, MaxConns) -> ok Ref = ref():: Listener name. @@ -176,6 +199,18 @@ Set the protocol options for the given listener. The change will be applied immediately for all new connections. Old connections will not receive the new options. +=== set_transport_options(Ref, TransOpts) -> ok | {error, running} + +Ref = ref():: Listener name. +ProtoOpts = any():: New transport options. + +Set the transport options for the given listener. + +The listener must be suspended for this call to succeed. +If the listener is running, `{error, running}` will be returned. + +The change will take effect when the listener is being resumed. + === start_listener(Ref, NumAcceptors, Transport, TransOpts, Protocol, ProtoOpts) -> {ok, pid()} | {error, badarg} Ref = ref():: Listener name. @@ -207,3 +242,14 @@ connection processes or give them some time to stop properly. This function does not return until the listener is completely stopped. + +=== suspend_listener(Ref) -> ok + +Ref = ref():: Listener name. + +Suspend the given listener if it is running. +If the listener is already suspended, nothing will happen. + +The listener will stop listening and accepting connections by +closing the listening port, but will not stop running connection +processes. |