1*a4d08de4SAdam Hornáček<!DOCTYPE html> 2*a4d08de4SAdam Hornáček<html lang="en"> 3eeb7e5b3SAdam Hornáček<head> 4*a4d08de4SAdam Hornáček<meta charset="UTF-8"> 5eeb7e5b3SAdam Hornáček<title>sampleFile - OpenGrok cross reference for /sampleFile</title></head><body> 6eeb7e5b3SAdam Hornáček<script type="text/javascript">/* <![CDATA[ */ 7eeb7e5b3SAdam Hornáčekfunction get_sym_list(){return [["Function","xf",[["flush",51],["loop",27],["start_link",22]]]];} /* ]]> */</script><a class="l" name="1" href="#1">1</a><span class="c">%% Copyright (c) 2011-2017, Loïc Hoguin <essen@ninenines.eu></span> 8eeb7e5b3SAdam Hornáček<a class="l" name="2" href="#2">2</a><span class="c">%%</span> 9eeb7e5b3SAdam Hornáček<a class="l" name="3" href="#3">3</a><span class="c">%% Permission to use, copy, modify, <a href="/source/s?path=and/">and</a>/<a href="/source/s?path=and/or">or</a> distribute this software for any</span> 10eeb7e5b3SAdam Hornáček<a class="l" name="4" href="#4">4</a><span class="c">%% purpose with or without fee is hereby granted, provided that the above</span> 11eeb7e5b3SAdam Hornáček<a class="l" name="5" href="#5">5</a><span class="c">%% copyright notice and this permission notice appear in all copies.</span> 12eeb7e5b3SAdam Hornáček<a class="l" name="6" href="#6">6</a><span class="c">%%</span> 13eeb7e5b3SAdam Hornáček<a class="l" name="7" href="#7">7</a><span class="c">%% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES</span> 14eeb7e5b3SAdam Hornáček<a class="l" name="8" href="#8">8</a><span class="c">%% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF</span> 15eeb7e5b3SAdam Hornáček<a class="l" name="9" href="#9">9</a><span class="c">%% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR</span> 16eeb7e5b3SAdam Hornáček<a class="hl" name="10" href="#10">10</a><span class="c">%% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES</span> 17eeb7e5b3SAdam Hornáček<a class="l" name="11" href="#11">11</a><span class="c">%% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN</span> 18eeb7e5b3SAdam Hornáček<a class="l" name="12" href="#12">12</a><span class="c">%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF</span> 19eeb7e5b3SAdam Hornáček<a class="l" name="13" href="#13">13</a><span class="c">%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</span> 20eeb7e5b3SAdam Hornáček<a class="l" name="14" href="#14">14</a> 21eeb7e5b3SAdam Hornáček<a class="l" name="15" href="#15">15</a>-<b>module</b>(<a class="d" name="ranch_acceptor"/><a href="/source/s?refs=ranch_acceptor" class="d intelliWindow-symbol" data-definition-place="def">ranch_acceptor</a>). 22eeb7e5b3SAdam Hornáček<a class="l" name="16" href="#16">16</a> 23eeb7e5b3SAdam Hornáček<a class="l" name="17" href="#17">17</a>-<b>export</b>([<a class="d intelliWindow-symbol" href="#start_link" data-definition-place="defined-in-file">start_link</a>/<span class="n">3</span>]). 24eeb7e5b3SAdam Hornáček<a class="l" name="18" href="#18">18</a>-<b>export</b>([<a class="d intelliWindow-symbol" href="#loop" data-definition-place="defined-in-file">loop</a>/<span class="n">3</span>]). 25eeb7e5b3SAdam Hornáček<a class="l" name="19" href="#19">19</a> 26eeb7e5b3SAdam Hornáček<a class="hl" name="20" href="#20">20</a>-<b>spec</b> <a class="d intelliWindow-symbol" href="#start_link" data-definition-place="defined-in-file">start_link</a>(<a href="/source/s?defs=inet" class="intelliWindow-symbol" data-definition-place="undefined-in-file">inet</a>:<a href="/source/s?defs=socket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">socket</a>(), <a href="/source/s?defs=module" class="intelliWindow-symbol" data-definition-place="undefined-in-file">module</a>(), <a href="/source/s?defs=pid" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pid</a>()) 27eeb7e5b3SAdam Hornáček<a class="l" name="21" href="#21">21</a> -> {<a href="/source/s?defs=ok" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ok</a>, <a href="/source/s?defs=pid" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pid</a>()}. 28eeb7e5b3SAdam Hornáček<a class="l" name="22" href="#22">22</a><a class="xf" name="start_link"/><a href="/source/s?refs=start_link" class="xf intelliWindow-symbol" data-definition-place="def">start_link</a>(<a href="/source/s?defs=LSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">LSocket</a>, <a href="/source/s?defs=Transport" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Transport</a>, <a href="/source/s?defs=ConnsSup" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ConnsSup</a>) -> 29eeb7e5b3SAdam Hornáček<a class="l" name="23" href="#23">23</a> <a href="/source/s?defs=Pid" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Pid</a> = <a href="/source/s?defs=spawn_link" class="intelliWindow-symbol" data-definition-place="undefined-in-file">spawn_link</a>(<span class="xm">?MODULE</span>, <a class="d intelliWindow-symbol" href="#loop" data-definition-place="defined-in-file">loop</a>, [<a href="/source/s?defs=LSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">LSocket</a>, <a href="/source/s?defs=Transport" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Transport</a>, <a href="/source/s?defs=ConnsSup" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ConnsSup</a>]), 30eeb7e5b3SAdam Hornáček<a class="l" name="24" href="#24">24</a> {<a href="/source/s?defs=ok" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ok</a>, <a href="/source/s?defs=Pid" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Pid</a>}. 31eeb7e5b3SAdam Hornáček<a class="l" name="25" href="#25">25</a> 32eeb7e5b3SAdam Hornáček<a class="l" name="26" href="#26">26</a>-<b>spec</b> <a class="d intelliWindow-symbol" href="#loop" data-definition-place="defined-in-file">loop</a>(<a href="/source/s?defs=inet" class="intelliWindow-symbol" data-definition-place="undefined-in-file">inet</a>:<a href="/source/s?defs=socket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">socket</a>(), <a href="/source/s?defs=module" class="intelliWindow-symbol" data-definition-place="undefined-in-file">module</a>(), <a href="/source/s?defs=pid" class="intelliWindow-symbol" data-definition-place="undefined-in-file">pid</a>()) -> <a href="/source/s?defs=no_return" class="intelliWindow-symbol" data-definition-place="undefined-in-file">no_return</a>(). 33eeb7e5b3SAdam Hornáček<a class="l" name="27" href="#27">27</a><a class="xf" name="loop"/><a href="/source/s?refs=loop" class="xf intelliWindow-symbol" data-definition-place="def">loop</a>(<a href="/source/s?defs=LSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">LSocket</a>, <a href="/source/s?defs=Transport" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Transport</a>, <a href="/source/s?defs=ConnsSup" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ConnsSup</a>) -> 34eeb7e5b3SAdam Hornáček<a class="l" name="28" href="#28">28</a> _ = <b>case</b> <a href="/source/s?defs=Transport" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Transport</a>:<a href="/source/s?defs=accept" class="intelliWindow-symbol" data-definition-place="undefined-in-file">accept</a>(<a href="/source/s?defs=LSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">LSocket</a>, <a href="/source/s?defs=infinity" class="intelliWindow-symbol" data-definition-place="undefined-in-file">infinity</a>) <b>of</b> 35eeb7e5b3SAdam Hornáček<a class="l" name="29" href="#29">29</a> {<a href="/source/s?defs=ok" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ok</a>, <a href="/source/s?defs=CSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CSocket</a>} -> 36eeb7e5b3SAdam Hornáček<a class="hl" name="30" href="#30">30</a> <b>case</b> <a href="/source/s?defs=Transport" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Transport</a>:<a href="/source/s?defs=controlling_process" class="intelliWindow-symbol" data-definition-place="undefined-in-file">controlling_process</a>(<a href="/source/s?defs=CSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CSocket</a>, <a href="/source/s?defs=ConnsSup" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ConnsSup</a>) <b>of</b> 37eeb7e5b3SAdam Hornáček<a class="l" name="31" href="#31">31</a> <a href="/source/s?defs=ok" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ok</a> -> 38eeb7e5b3SAdam Hornáček<a class="l" name="32" href="#32">32</a> <span class="c">%% This call will not return until process has been started</span> 39eeb7e5b3SAdam Hornáček<a class="l" name="33" href="#33">33</a> <span class="c">%% AND we are below the maximum number of connections.</span> 40eeb7e5b3SAdam Hornáček<a class="l" name="34" href="#34">34</a> <a href="/source/s?defs=ranch_conns_sup" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ranch_conns_sup</a>:<a href="/source/s?defs=start_protocol" class="intelliWindow-symbol" data-definition-place="undefined-in-file">start_protocol</a>(<a href="/source/s?defs=ConnsSup" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ConnsSup</a>, <a href="/source/s?defs=CSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CSocket</a>); 41eeb7e5b3SAdam Hornáček<a class="l" name="35" href="#35">35</a> {<a href="/source/s?defs=error" class="intelliWindow-symbol" data-definition-place="undefined-in-file">error</a>, _} -> 42eeb7e5b3SAdam Hornáček<a class="l" name="36" href="#36">36</a> <a href="/source/s?defs=Transport" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Transport</a>:<a href="/source/s?defs=close" class="intelliWindow-symbol" data-definition-place="undefined-in-file">close</a>(<a href="/source/s?defs=CSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">CSocket</a>) 43eeb7e5b3SAdam Hornáček<a class="l" name="37" href="#37">37</a> <b>end</b>; 44eeb7e5b3SAdam Hornáček<a class="l" name="38" href="#38">38</a> <span class="c">%% Reduce the accept rate if we run out of file descriptors.</span> 45eeb7e5b3SAdam Hornáček<a class="l" name="39" href="#39">39</a> <span class="c">%% We can't accept anymore anyway, so we might as well wait</span> 46eeb7e5b3SAdam Hornáček<a class="hl" name="40" href="#40">40</a> <span class="c">%% a little for the situation to resolve itself.</span> 47eeb7e5b3SAdam Hornáček<a class="l" name="41" href="#41">41</a> {<a href="/source/s?defs=error" class="intelliWindow-symbol" data-definition-place="undefined-in-file">error</a>, <a href="/source/s?defs=emfile" class="intelliWindow-symbol" data-definition-place="undefined-in-file">emfile</a>} -> 48eeb7e5b3SAdam Hornáček<a class="l" name="42" href="#42">42</a> <a href="/source/s?defs=error_logger" class="intelliWindow-symbol" data-definition-place="undefined-in-file">error_logger</a>:<a href="/source/s?defs=warning_msg" class="intelliWindow-symbol" data-definition-place="undefined-in-file">warning_msg</a>(<span class="s">"Ranch acceptor reducing accept rate: out of file descriptors~n"</span>), 49eeb7e5b3SAdam Hornáček<a class="l" name="43" href="#43">43</a> <b>receive</b> <b>after</b> <span class="n">0xFF</span> -> <a href="/source/s?defs=ok" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ok</a> <b>end</b>; 50eeb7e5b3SAdam Hornáček<a class="l" name="44" href="#44">44</a> <span class="c">%% We want to crash if the listening socket got closed.</span> 51eeb7e5b3SAdam Hornáček<a class="l" name="45" href="#45">45</a> {<a href="/source/s?defs=error" class="intelliWindow-symbol" data-definition-place="undefined-in-file">error</a>, <a href="/source/s?defs=Reason" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reason</a>} <b>when</b> <a href="/source/s?defs=Reason" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Reason</a> =/= <a href="/source/s?defs=closed" class="intelliWindow-symbol" data-definition-place="undefined-in-file">closed</a> -> 52eeb7e5b3SAdam Hornáček<a class="l" name="46" href="#46">46</a> <a href="/source/s?defs=ok" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ok</a> 53eeb7e5b3SAdam Hornáček<a class="l" name="47" href="#47">47</a> <b>end</b>, 54eeb7e5b3SAdam Hornáček<a class="l" name="48" href="#48">48</a> <a class="d intelliWindow-symbol" href="#flush" data-definition-place="defined-in-file">flush</a>(), 55eeb7e5b3SAdam Hornáček<a class="l" name="49" href="#49">49</a> <span class="xm">?MODULE</span>:<a class="d intelliWindow-symbol" href="#loop" data-definition-place="defined-in-file">loop</a>(<a href="/source/s?defs=LSocket" class="intelliWindow-symbol" data-definition-place="undefined-in-file">LSocket</a>, <a href="/source/s?defs=Transport" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Transport</a>, <a href="/source/s?defs=ConnsSup" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ConnsSup</a>). 56eeb7e5b3SAdam Hornáček<a class="hl" name="50" href="#50">50</a> 57eeb7e5b3SAdam Hornáček<a class="l" name="51" href="#51">51</a><a class="xf" name="flush"/><a href="/source/s?refs=flush" class="xf intelliWindow-symbol" data-definition-place="def">flush</a>() -> 58eeb7e5b3SAdam Hornáček<a class="l" name="52" href="#52">52</a> <b>receive</b> <a href="/source/s?defs=Msg" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Msg</a> -> 59eeb7e5b3SAdam Hornáček<a class="l" name="53" href="#53">53</a> <a href="/source/s?defs=error_logger" class="intelliWindow-symbol" data-definition-place="undefined-in-file">error_logger</a>:<a href="/source/s?defs=error_msg" class="intelliWindow-symbol" data-definition-place="undefined-in-file">error_msg</a>( 60eeb7e5b3SAdam Hornáček<a class="l" name="54" href="#54">54</a> <span class="s">"Ranch acceptor received unexpected message: ~p~n"</span>, 61eeb7e5b3SAdam Hornáček<a class="l" name="55" href="#55">55</a> [<a href="/source/s?defs=Msg" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Msg</a>]), 62eeb7e5b3SAdam Hornáček<a class="l" name="56" href="#56">56</a> <a class="d intelliWindow-symbol" href="#flush" data-definition-place="defined-in-file">flush</a>() 63eeb7e5b3SAdam Hornáček<a class="l" name="57" href="#57">57</a> <b>after</b> <span class="n">0</span> -> 64eeb7e5b3SAdam Hornáček<a class="l" name="58" href="#58">58</a> <a href="/source/s?defs=ok" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ok</a> 65eeb7e5b3SAdam Hornáček<a class="l" name="59" href="#59">59</a> <b>end</b>. 66eeb7e5b3SAdam Hornáček<a class="hl" name="60" href="#60">60</a><span class="s">'<a href="http://example.com?a=">http://example.com?a=</a>'</span> 67eeb7e5b3SAdam Hornáček<a class="l" name="61" href="#61">61</a>-<b>include</b>(<span class="s">"<a href="/source/s?path=incdir/">incdir</a>/<a href="/source/s?path=incdir/more_records.hrl">more_records.hrl</a>"</span>). 68eeb7e5b3SAdam Hornáček<a class="l" name="62" href="#62">62</a></body> 69eeb7e5b3SAdam Hornáček</html> 70