summaryrefslogtreecommitdiffstats
path: root/docs/en/ranch/1.6/guide/protocols/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/en/ranch/1.6/guide/protocols/index.html')
-rw-r--r--docs/en/ranch/1.6/guide/protocols/index.html6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/en/ranch/1.6/guide/protocols/index.html b/docs/en/ranch/1.6/guide/protocols/index.html
index f002909d..97b47dc2 100644
--- a/docs/en/ranch/1.6/guide/protocols/index.html
+++ b/docs/en/ranch/1.6/guide/protocols/index.html
@@ -67,7 +67,7 @@
<p>All protocol handlers must implement the <code>ranch_protocol</code> behavior which defines a single callback, <code>start_link/4</code>. This callback is responsible for spawning a new process for handling the connection. It receives four arguments: the name of the listener, the socket, the transport handler being used and the protocol options defined in the call to <code>ranch:start_listener/5</code>. This callback must return <code>{ok, Pid}</code>, with <code>Pid</code> the pid of the new process.</p>
<p>The newly started process can then freely initialize itself. However, it must call <code>ranch:handshake/1,2</code> before doing any socket operation. This will ensure the connection process is the owner of the socket. It expects the listener&apos;s name as argument.</p>
<div class="listingblock"><div class="title">Perform the socket handshake</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -76,7 +76,7 @@ http://www.gnu.org/software/src-highlite -->
<p>If your protocol code requires specific socket options, you should set them while initializing your connection process, after calling <code>ranch:handshake/1,2</code>. You can use <code>Transport:setopts/2</code> for that purpose.</p>
<p>Following is the complete protocol code for the example found in <code>examples/tcp_echo/</code>.</p>
<div class="listingblock"><div class="title">Protocol module that echoes everything it receives</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -107,7 +107,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Special processes like the ones that use the <code>gen_statem</code> or <code>gen_server</code> behaviours have the particularity of having their <code>start_link</code> call not return until the <code>init</code> function returns. This is problematic, because you won&apos;t be able to call <code>ranch:handshake/1,2</code> from the <code>init</code> callback as this would cause a deadlock to happen.</p>
<p>Use the <code>gen_statem:enter_loop/4</code> function. It allows you to start your process normally (although it must be started with <code>proc_lib</code> like all special processes), then perform any needed operations before falling back into the normal <code>gen_statem</code> execution loop.</p>
<div class="listingblock"><div class="title">Use a gen_statem for protocol handling</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->