<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16">
  <compounddef id="tcp_8c" kind="file" language="C++">
    <compoundname>tcp.c</compoundname>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <incdepgraph>
      <node id="17">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="18">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="15">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="8">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="6">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="9">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="14">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/tcp.c</label>
        <link refid="tcp_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="10">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>Transmission Control Protocol for IP See also <ref refid="group__tcp__raw" kindref="compound">TCP</ref> </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="16"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001-2004<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="24"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.</highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the<sp/>documentation</highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="28"><highlight class="comment"><sp/>*<sp/>3.<sp/>The<sp/>name<sp/>of<sp/>the<sp/>author<sp/>may<sp/>not<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products</highlight></codeline>
<codeline lineno="29"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.</highlight></codeline>
<codeline lineno="30"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="31"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>``AS<sp/>IS&apos;&apos;<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline>
<codeline lineno="32"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF</highlight></codeline>
<codeline lineno="33"><highlight class="comment"><sp/>*<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT</highlight></codeline>
<codeline lineno="34"><highlight class="comment"><sp/>*<sp/>SHALL<sp/>THE<sp/>AUTHOR<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,</highlight></codeline>
<codeline lineno="35"><highlight class="comment"><sp/>*<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT</highlight></codeline>
<codeline lineno="36"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY</highlight></codeline>
<codeline lineno="40"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="42"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline>
<codeline lineno="43"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="44"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Adam<sp/>Dunkels<sp/>&lt;adam@sics.se&gt;</highlight></codeline>
<codeline lineno="45"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="46"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="47"><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="opt_8h" kindref="compound">net/opt.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP<sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>build<sp/>if<sp/>not<sp/>configured<sp/>for<sp/>use<sp/>in<sp/>lwipopts.h<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="def_8h" kindref="compound">net/def.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="53"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="mem_8h" kindref="compound">net/mem.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="54"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="memp_8h" kindref="compound">net/memp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="tcp_8h" kindref="compound">net/tcp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="tcp__priv_8h" kindref="compound">net/priv/tcp_priv.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="debug_8h" kindref="compound">net/debug.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="stats_8h" kindref="compound">net/stats.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip6_8h" kindref="compound">net/ip6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip6__addr_8h" kindref="compound">net/ip6_addr.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="nd6_8h" kindref="compound">net/nd6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="string_8h" kindref="compound">string.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_FILENAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>LWIP_HOOK_FILENAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>TCP_LOCAL_PORT_RANGE_START</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>From<sp/>http://www.iana.org/assignments/port-numbers:</highlight></codeline>
<codeline lineno="71"><highlight class="comment"><sp/><sp/><sp/>&quot;The<sp/>Dynamic<sp/>and/or<sp/>Private<sp/>Ports<sp/>are<sp/>those<sp/>from<sp/>49152<sp/>through<sp/>65535&quot;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>TCP_LOCAL_PORT_RANGE_START<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>0xc000</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>TCP_LOCAL_PORT_RANGE_END<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>0xffff</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>TCP_ENSURE_LOCAL_PORT_RANGE(port)<sp/>((u16_t)(((port)<sp/>&amp;<sp/>~TCP_LOCAL_PORT_RANGE_START)<sp/>+<sp/>TCP_LOCAL_PORT_RANGE_START))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP_KEEPALIVE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>TCP_KEEP_DUR(pcb)<sp/><sp/><sp/>((pcb)-&gt;keep_cnt<sp/>*<sp/>(pcb)-&gt;keep_intvl)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>TCP_KEEP_INTVL(pcb)<sp/>((pcb)-&gt;keep_intvl)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP_KEEPALIVE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>TCP_KEEP_DUR(pcb)<sp/><sp/><sp/>TCP_MAXIDLE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>TCP_KEEP_INTVL(pcb)<sp/>TCP_KEEPINTVL_DEFAULT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP_KEEPALIVE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>As<sp/>initial<sp/>send<sp/>MSS,<sp/>we<sp/>use<sp/>TCP_MSS<sp/>but<sp/>limit<sp/>it<sp/>to<sp/>536.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_MSS<sp/>&gt;<sp/>536</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>INITIAL_MSS<sp/>536</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>INITIAL_MSS<sp/>TCP_MSS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"></highlight></codeline>
<codeline lineno="92"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>tcp_state_str[]<sp/>=<sp/>{</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;CLOSED&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;LISTEN&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;SYN_SENT&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;SYN_RCVD&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;ESTABLISHED&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;FIN_WAIT_1&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;FIN_WAIT_2&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;CLOSE_WAIT&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;CLOSING&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;LAST_ACK&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/></highlight><highlight class="stringliteral">&quot;TIME_WAIT&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal">};</highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>last<sp/>local<sp/>TCP<sp/>port<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>tcp_port<sp/>=<sp/>TCP_LOCAL_PORT_RANGE_START;</highlight></codeline>
<codeline lineno="108"><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Incremented<sp/>every<sp/>coarse<sp/>grained<sp/>timer<sp/>shot<sp/>(typically<sp/>every<sp/>500<sp/>ms).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>tcp_ticks;</highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tcp_backoff[13]<sp/>=</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/>{<sp/>1,<sp/>2,<sp/>3,<sp/>4,<sp/>5,<sp/>6,<sp/>7,<sp/>7,<sp/>7,<sp/>7,<sp/>7,<sp/>7,<sp/>7};</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/></highlight><highlight class="comment">/*<sp/>Times<sp/>per<sp/>slowtmr<sp/>hits<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tcp_persist_backoff[7]<sp/>=<sp/>{<sp/>3,<sp/>6,<sp/>12,<sp/>24,<sp/>48,<sp/>96,<sp/>120<sp/>};</highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>The<sp/>TCP<sp/>PCB<sp/>lists.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*tcp_bound_pcbs;</highlight></codeline>
<codeline lineno="121"><highlight class="keyword">union<sp/></highlight><highlight class="normal">tcp_listen_pcbs_t<sp/>tcp_listen_pcbs;</highlight></codeline>
<codeline lineno="124"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*tcp_active_pcbs;</highlight></codeline>
<codeline lineno="126"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*tcp_tw_pcbs;</highlight></codeline>
<codeline lineno="127"><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>**<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>tcp_pcb_lists[]<sp/>=<sp/>{&amp;tcp_listen_pcbs.pcbs,<sp/>&amp;tcp_bound_pcbs,</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/>&amp;tcp_active_pcbs,<sp/>&amp;tcp_tw_pcbs};</highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tcp_active_pcbs_changed;</highlight></codeline>
<codeline lineno="133"><highlight class="normal"></highlight></codeline>
<codeline lineno="135"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tcp_timer;</highlight></codeline>
<codeline lineno="136"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tcp_timer_ctr;</highlight></codeline>
<codeline lineno="137"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>tcp_new_port(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="138"><highlight class="normal"></highlight></codeline>
<codeline lineno="139"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>tcp_close_shutdown_fin(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb);</highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight></codeline>
<codeline lineno="144"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="145"><highlight class="normal">tcp_init(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="146"><highlight class="normal">{</highlight></codeline>
<codeline lineno="147"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS<sp/>&amp;&amp;<sp/>defined(LWIP_RAND)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/>tcp_port<sp/>=<sp/>TCP_ENSURE_LOCAL_PORT_RANGE(LWIP_RAND());</highlight></codeline>
<codeline lineno="149"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS<sp/>&amp;&amp;<sp/>defined(LWIP_RAND)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="150"><highlight class="normal">}</highlight></codeline>
<codeline lineno="151"><highlight class="normal"></highlight></codeline>
<codeline lineno="155"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="156"><highlight class="normal">tcp_tmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="157"><highlight class="normal">{</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Call<sp/>tcp_fasttmr()<sp/>every<sp/>250<sp/>ms<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/>tcp_fasttmr();</highlight></codeline>
<codeline lineno="160"><highlight class="normal"></highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(++tcp_timer<sp/>&amp;<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Call<sp/>tcp_slowtmr()<sp/>every<sp/>500<sp/>ms,<sp/>i.e.,<sp/>every<sp/>other<sp/>timer</highlight></codeline>
<codeline lineno="163"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_tmr()<sp/>is<sp/>called.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_slowtmr();</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="166"><highlight class="normal">}</highlight></codeline>
<codeline lineno="167"><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API<sp/>||<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="169"><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="173"><highlight class="normal">tcp_remove_listener(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*list,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb_listen<sp/>*lpcb)</highlight></codeline>
<codeline lineno="174"><highlight class="normal">{</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb;</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>list;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;listener<sp/>==<sp/>lpcb)<sp/>{</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;listener<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="181"><highlight class="normal">}</highlight></codeline>
<codeline lineno="182"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal">tcp_listen_closed(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="189"><highlight class="normal">{</highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API<sp/>||<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pcb<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pcb-&gt;state<sp/>==<sp/>LISTEN&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>==<sp/>LISTEN);</highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>1;<sp/>i<sp/>&lt;<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(tcp_pcb_lists);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_remove_listener(*tcp_pcb_lists[i],<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb_listen*)pcb);</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="197"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(pcb);</highlight></codeline>
<codeline lineno="199"><highlight class="normal">}</highlight></codeline>
<codeline lineno="200"><highlight class="normal"></highlight></codeline>
<codeline lineno="201"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="202"><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="normal">tcp_backlog_delayed(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb*<sp/>pcb)</highlight></codeline>
<codeline lineno="214"><highlight class="normal">{</highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pcb<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((pcb-&gt;flags<sp/>&amp;<sp/>TF_BACKLOGPEND)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;listener<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;listener-&gt;accepts_pending++;</highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;accepts_pending<sp/>!=<sp/>0&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;listener-&gt;accepts_pending<sp/>!=<sp/>0);</highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>|=<sp/>TF_BACKLOGPEND;</highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="223"><highlight class="normal">}</highlight></codeline>
<codeline lineno="224"><highlight class="normal"></highlight></codeline>
<codeline lineno="234"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="235"><highlight class="normal">tcp_backlog_accepted(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb*<sp/>pcb)</highlight></codeline>
<codeline lineno="236"><highlight class="normal">{</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pcb<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((pcb-&gt;flags<sp/>&amp;<sp/>TF_BACKLOGPEND)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;listener<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;accepts_pending<sp/>!=<sp/>0&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;listener-&gt;accepts_pending<sp/>!=<sp/>0);</highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;listener-&gt;accepts_pending--;</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>&amp;=<sp/>~TF_BACKLOGPEND;</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="245"><highlight class="normal">}</highlight></codeline>
<codeline lineno="246"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="247"><highlight class="normal"></highlight></codeline>
<codeline lineno="264"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="265"><highlight class="normal">tcp_close_shutdown(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>rst_on_unacked_data)</highlight></codeline>
<codeline lineno="266"><highlight class="normal">{</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(rst_on_unacked_data<sp/>&amp;&amp;<sp/>((pcb-&gt;state<sp/>==<sp/>ESTABLISHED)<sp/>||<sp/>(pcb-&gt;state<sp/>==<sp/>CLOSE_WAIT)))<sp/>{</highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((pcb-&gt;refused_data<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(pcb-&gt;rcv_wnd<sp/>!=<sp/>TCP_WND_MAX(pcb)))<sp/>{</highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Not<sp/>all<sp/>data<sp/>received<sp/>by<sp/>application,<sp/>send<sp/>RST<sp/>to<sp/>tell<sp/>the<sp/>remote</highlight></codeline>
<codeline lineno="270"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>side<sp/>about<sp/>this.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pcb-&gt;flags<sp/>&amp;<sp/>TF_RXCLOSED&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;flags<sp/>&amp;<sp/>TF_RXCLOSED);</highlight></codeline>
<codeline lineno="272"><highlight class="normal"></highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>call<sp/>tcp_abort<sp/>here:<sp/>we<sp/>must<sp/>not<sp/>deallocate<sp/>the<sp/>pcb<sp/>since</highlight></codeline>
<codeline lineno="274"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>that<sp/>might<sp/>not<sp/>be<sp/>expected<sp/>when<sp/>calling<sp/>tcp_close<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_rst(pcb-&gt;snd_nxt,<sp/>pcb-&gt;rcv_nxt,<sp/>&amp;pcb-&gt;local_ip,<sp/>&amp;pcb-&gt;remote_ip,</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;local_port,<sp/>pcb-&gt;remote_port);</highlight></codeline>
<codeline lineno="277"><highlight class="normal"></highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_pcb_purge(pcb);</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>TCP_RMV_ACTIVE(pcb);</highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>ESTABLISHED)<sp/>{</highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>move<sp/>to<sp/>TIME_WAIT<sp/>since<sp/>we<sp/>close<sp/>actively<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>=<sp/>TIME_WAIT;</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>TCP_REG(&amp;tcp_tw_pcbs,<sp/>pcb);</highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>CLOSE_WAIT:<sp/>deallocate<sp/>the<sp/>pcb<sp/>since<sp/>we<sp/>already<sp/>sent<sp/>a<sp/>RST<sp/>for<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tcp_input_pcb<sp/>==<sp/>pcb)<sp/>{</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>prevent<sp/>using<sp/>a<sp/>deallocated<sp/>pcb:<sp/>free<sp/>it<sp/>from<sp/>tcp_input<sp/>later<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_trigger_input_pcb_close();</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB,<sp/>pcb);</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="296"><highlight class="normal"></highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>-<sp/>states<sp/>which<sp/>free<sp/>the<sp/>pcb<sp/>are<sp/>handled<sp/>here,</highlight></codeline>
<codeline lineno="298"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>-<sp/>states<sp/>which<sp/>send<sp/>FIN<sp/>and<sp/>change<sp/>state<sp/>are<sp/>handled<sp/>in<sp/>tcp_close_shutdown_fin()<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(pcb-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>CLOSED:</highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Closing<sp/>a<sp/>pcb<sp/>in<sp/>the<sp/>CLOSED<sp/>state<sp/>might<sp/>seem<sp/>erroneous,</highlight></codeline>
<codeline lineno="302"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>however,<sp/>it<sp/>is<sp/>in<sp/>this<sp/>state<sp/>once<sp/>allocated<sp/>and<sp/>as<sp/>yet<sp/>unused</highlight></codeline>
<codeline lineno="303"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>and<sp/>the<sp/>user<sp/>needs<sp/>some<sp/>way<sp/>to<sp/>free<sp/>it<sp/>should<sp/>the<sp/>need<sp/>arise.</highlight></codeline>
<codeline lineno="304"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>Calling<sp/>tcp_close()<sp/>with<sp/>a<sp/>pcb<sp/>that<sp/>has<sp/>already<sp/>been<sp/>closed,<sp/>(i.e.<sp/>twice)</highlight></codeline>
<codeline lineno="305"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>or<sp/>for<sp/>a<sp/>pcb<sp/>that<sp/>has<sp/>been<sp/>used<sp/>and<sp/>then<sp/>entered<sp/>the<sp/>CLOSED<sp/>state</highlight></codeline>
<codeline lineno="306"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>is<sp/>erroneous,<sp/>but<sp/>this<sp/>should<sp/>never<sp/>happen<sp/>as<sp/>the<sp/>pcb<sp/>has<sp/>in<sp/>those<sp/>cases</highlight></codeline>
<codeline lineno="307"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>been<sp/>freed,<sp/>and<sp/>so<sp/>any<sp/>remaining<sp/>handles<sp/>are<sp/>bogus.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;local_port<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>TCP_RMV(&amp;tcp_bound_pcbs,<sp/>pcb);</highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB,<sp/>pcb);</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>LISTEN:</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_listen_closed(pcb);</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_pcb_remove(&amp;tcp_listen_pcbs.pcbs,<sp/>pcb);</highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB_LISTEN,<sp/>pcb);</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>SYN_SENT:</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/>TCP_PCB_REMOVE_ACTIVE(pcb);</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB,<sp/>pcb);</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.tcpattemptfails);</highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_close_shutdown_fin(pcb);</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="327"><highlight class="normal">}</highlight></codeline>
<codeline lineno="328"><highlight class="normal"></highlight></codeline>
<codeline lineno="329"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="330"><highlight class="normal">tcp_close_shutdown_fin(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="331"><highlight class="normal">{</highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pcb<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="334"><highlight class="normal"></highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(pcb-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>SYN_RCVD:</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/>tcp_send_fin(pcb);</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_backlog_accepted(pcb);</highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.tcpattemptfails);</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>=<sp/>FIN_WAIT_1;</highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>ESTABLISHED:</highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/>tcp_send_fin(pcb);</highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.tcpestabresets);</highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>=<sp/>FIN_WAIT_1;</highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>CLOSE_WAIT:</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/>tcp_send_fin(pcb);</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.tcpestabresets);</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>=<sp/>LAST_ACK;</highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Has<sp/>already<sp/>been<sp/>closed,<sp/>do<sp/>nothing.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="362"><highlight class="normal"></highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>To<sp/>ensure<sp/>all<sp/>data<sp/>has<sp/>been<sp/>sent<sp/>when<sp/>tcp_close<sp/>returns,<sp/>we<sp/>have</highlight></codeline>
<codeline lineno="365"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>to<sp/>make<sp/>sure<sp/>tcp_output<sp/>doesn&apos;t<sp/>fail.</highlight></codeline>
<codeline lineno="366"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Since<sp/>we<sp/>don&apos;t<sp/>really<sp/>have<sp/>to<sp/>ensure<sp/>all<sp/>data<sp/>has<sp/>been<sp/>sent<sp/>when<sp/>tcp_close</highlight></codeline>
<codeline lineno="367"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>returns<sp/>(unsent<sp/>data<sp/>is<sp/>sent<sp/>from<sp/>tcp<sp/>timer<sp/>functions,<sp/>also),<sp/>we<sp/>don&apos;t<sp/>care</highlight></codeline>
<codeline lineno="368"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>for<sp/>the<sp/>return<sp/>value<sp/>of<sp/>tcp_output<sp/>for<sp/>now.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_output(pcb);</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>)<sp/>{</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Mark<sp/>this<sp/>pcb<sp/>for<sp/>closing.<sp/>Closing<sp/>is<sp/>retried<sp/>from<sp/>tcp_tmr.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>|=<sp/>TF_CLOSEPEND;</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>have<sp/>to<sp/>return<sp/>ERR_OK<sp/>from<sp/>here<sp/>to<sp/>indicate<sp/>to<sp/>the<sp/>callers<sp/>that<sp/>this</highlight></codeline>
<codeline lineno="374"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>should<sp/>not<sp/>be<sp/>used<sp/>any<sp/>more<sp/>as<sp/>it<sp/>will<sp/>be<sp/>freed<sp/>soon<sp/>via<sp/>tcp_tmr.</highlight></codeline>
<codeline lineno="375"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>This<sp/>is<sp/>OK<sp/>here<sp/>since<sp/>sending<sp/>FIN<sp/>does<sp/>not<sp/>guarantee<sp/>a<sp/>time<sp/>frime<sp/>for</highlight></codeline>
<codeline lineno="376"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>actually<sp/>freeing<sp/>the<sp/>pcb,<sp/>either<sp/>(it<sp/>is<sp/>left<sp/>in<sp/>closure<sp/>states<sp/>for</highlight></codeline>
<codeline lineno="377"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>remote<sp/>ACK<sp/>or<sp/>timeout)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="381"><highlight class="normal">}</highlight></codeline>
<codeline lineno="382"><highlight class="normal"></highlight></codeline>
<codeline lineno="398"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="399"><highlight class="normal">tcp_close(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="400"><highlight class="normal">{</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_close:<sp/>closing<sp/>in<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/>tcp_debug_print_state(pcb-&gt;state);</highlight></codeline>
<codeline lineno="403"><highlight class="normal"></highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>!=<sp/>LISTEN)<sp/>{</highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>a<sp/>flag<sp/>not<sp/>to<sp/>receive<sp/>any<sp/>more<sp/>data...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>|=<sp/>TF_RXCLOSED;</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>...<sp/>and<sp/>close<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_close_shutdown(pcb,<sp/>1);</highlight></codeline>
<codeline lineno="410"><highlight class="normal">}</highlight></codeline>
<codeline lineno="411"><highlight class="normal"></highlight></codeline>
<codeline lineno="425"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="426"><highlight class="normal">tcp_shutdown(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>shut_rx,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>shut_tx)</highlight></codeline>
<codeline lineno="427"><highlight class="normal">{</highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>LISTEN)<sp/>{</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab0036c51817b5200bfe8157cc4115b27" kindref="member">ERR_CONN</ref>;</highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(shut_rx)<sp/>{</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>shut<sp/>down<sp/>the<sp/>receive<sp/>side:<sp/>set<sp/>a<sp/>flag<sp/>not<sp/>to<sp/>receive<sp/>any<sp/>more<sp/>data...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>|=<sp/>TF_RXCLOSED;</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(shut_tx)<sp/>{</highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>shutting<sp/>down<sp/>the<sp/>tx<sp/>AND<sp/>rx<sp/>side<sp/>is<sp/>the<sp/>same<sp/>as<sp/>closing<sp/>for<sp/>the<sp/>raw<sp/>API<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_close_shutdown(pcb,<sp/>1);</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>...<sp/>and<sp/>free<sp/>buffered<sp/>data<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;refused_data<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="440"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(pcb-&gt;refused_data);</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;refused_data<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(shut_tx)<sp/>{</highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>can&apos;t<sp/>happen<sp/>twice<sp/>since<sp/>if<sp/>it<sp/>succeeds,<sp/>the<sp/>pcb&apos;s<sp/>state<sp/>is<sp/>changed.</highlight></codeline>
<codeline lineno="446"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Only<sp/>close<sp/>in<sp/>these<sp/>states<sp/>as<sp/>the<sp/>others<sp/>directly<sp/>deallocate<sp/>the<sp/>PCB<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(pcb-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>SYN_RCVD:</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>ESTABLISHED:</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>CLOSE_WAIT:</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_close_shutdown(pcb,<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)shut_rx);</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Not<sp/>(yet?)<sp/>connected,<sp/>cannot<sp/>shutdown<sp/>the<sp/>TX<sp/>side<sp/>as<sp/>that<sp/>would<sp/>bring<sp/>us</highlight></codeline>
<codeline lineno="454"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>into<sp/>CLOSED<sp/>state,<sp/>where<sp/>the<sp/>PCB<sp/>is<sp/>deallocated.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab0036c51817b5200bfe8157cc4115b27" kindref="member">ERR_CONN</ref>;</highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="459"><highlight class="normal">}</highlight></codeline>
<codeline lineno="460"><highlight class="normal"></highlight></codeline>
<codeline lineno="469"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="470"><highlight class="normal">tcp_abandon(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="fdc_8h_1a3aea9deb2a0bfea9ff05a898f4822e31" kindref="member">reset</ref>)</highlight></codeline>
<codeline lineno="471"><highlight class="normal">{</highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>seqno,<sp/>ackno;</highlight></codeline>
<codeline lineno="473"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="474"><highlight class="normal"><sp/><sp/>tcp_err_fn<sp/>errf;</highlight></codeline>
<codeline lineno="475"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="476"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*errf_arg;</highlight></codeline>
<codeline lineno="477"><highlight class="normal"></highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pcb-&gt;state<sp/>LISTEN<sp/>not<sp/>allowed<sp/>here<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="479"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;don&apos;t<sp/>call<sp/>tcp_abort/tcp_abandon<sp/>for<sp/>listen-pcbs&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN);</highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Figure<sp/>out<sp/>on<sp/>which<sp/>TCP<sp/>PCB<sp/>list<sp/>we<sp/>are,<sp/>and<sp/>remove<sp/>us.<sp/>If<sp/>we</highlight></codeline>
<codeline lineno="482"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>are<sp/>in<sp/>an<sp/>active<sp/>state,<sp/>call<sp/>the<sp/>receive<sp/>function<sp/>associated<sp/>with</highlight></codeline>
<codeline lineno="483"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>the<sp/>PCB<sp/>with<sp/>a<sp/>NULL<sp/>argument,<sp/>and<sp/>send<sp/>an<sp/>RST<sp/>to<sp/>the<sp/>remote<sp/>end.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>TIME_WAIT)<sp/>{</highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_pcb_remove(&amp;tcp_tw_pcbs,<sp/>pcb);</highlight></codeline>
<codeline lineno="486"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB,<sp/>pcb);</highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>send_rst<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>local_port<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>tcp_state<sp/>last_state;</highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/>seqno<sp/>=<sp/>pcb-&gt;snd_nxt;</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/><sp/><sp/>ackno<sp/>=<sp/>pcb-&gt;rcv_nxt;</highlight></codeline>
<codeline lineno="493"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/><sp/><sp/>errf<sp/>=<sp/>pcb-&gt;errf;</highlight></codeline>
<codeline lineno="495"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><sp/><sp/>errf_arg<sp/>=<sp/>pcb-&gt;callback_arg;</highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>CLOSED)<sp/>{</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;local_port<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>bound,<sp/>not<sp/>yet<sp/>opened<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>TCP_RMV(&amp;tcp_bound_pcbs,<sp/>pcb);</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>send_rst<sp/>=<sp/><ref refid="fdc_8h_1a3aea9deb2a0bfea9ff05a898f4822e31" kindref="member">reset</ref>;</highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>local_port<sp/>=<sp/>pcb-&gt;local_port;</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>TCP_PCB_REMOVE_ACTIVE(pcb);</highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;unacked<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_segs_free(pcb-&gt;unacked);</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;unsent<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_segs_free(pcb-&gt;unsent);</highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="513"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_QUEUE_OOSEQ</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;ooseq<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_segs_free(pcb-&gt;ooseq);</highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="517"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_backlog_accepted(pcb);</highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(send_rst)<sp/>{</highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a37596f7bbb9b7663826244ba54486679" kindref="member">TCP_RST_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_abandon:<sp/>sending<sp/>RST\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_rst(seqno,<sp/>ackno,<sp/>&amp;pcb-&gt;local_ip,<sp/>&amp;pcb-&gt;remote_ip,<sp/>local_port,<sp/>pcb-&gt;remote_port);</highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/>last_state<sp/>=<sp/>pcb-&gt;state;</highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB,<sp/>pcb);</highlight></codeline>
<codeline lineno="525"><highlight class="normal"><sp/><sp/><sp/><sp/>TCP_EVENT_ERR(last_state,<sp/>errf,<sp/>errf_arg,<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaf316b2c5eee4079820f7100849115142" kindref="member">ERR_ABRT</ref>);</highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="527"><highlight class="normal">}</highlight></codeline>
<codeline lineno="528"><highlight class="normal"></highlight></codeline>
<codeline lineno="540"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="541"><highlight class="normal">tcp_abort(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="542"><highlight class="normal">{</highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/>tcp_abandon(pcb,<sp/>1);</highlight></codeline>
<codeline lineno="544"><highlight class="normal">}</highlight></codeline>
<codeline lineno="545"><highlight class="normal"></highlight></codeline>
<codeline lineno="561"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="562"><highlight class="normal">tcp_bind(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*ipaddr,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>port)</highlight></codeline>
<codeline lineno="563"><highlight class="normal">{</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>max_pcb_list<sp/>=<sp/>NUM_TCP_PCB_LISTS;</highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*cpcb;</highlight></codeline>
<codeline lineno="567"><highlight class="normal"></highlight></codeline>
<codeline lineno="568"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>propagate<sp/>NULL<sp/>pointer<sp/>(IPv4<sp/>ANY)<sp/>to<sp/>subsequent<sp/>functions<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="570"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipaddr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/><sp/><sp/>ipaddr<sp/>=<sp/>IP4_ADDR_ANY;</highlight></codeline>
<codeline lineno="572"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="573"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="574"><highlight class="normal"></highlight></codeline>
<codeline lineno="575"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>still<sp/>need<sp/>to<sp/>check<sp/>for<sp/>ipaddr<sp/>==<sp/>NULL<sp/>in<sp/>IPv6<sp/>only<sp/>case<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(ipaddr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="577"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;</highlight></codeline>
<codeline lineno="578"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="579"><highlight class="normal"></highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;tcp_bind:<sp/>can<sp/>only<sp/>bind<sp/>in<sp/>state<sp/>CLOSED&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>==<sp/>CLOSED,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>);</highlight></codeline>
<codeline lineno="581"><highlight class="normal"></highlight></codeline>
<codeline lineno="582"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>SO_REUSE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Unless<sp/>the<sp/>REUSEADDR<sp/>flag<sp/>is<sp/>set,</highlight></codeline>
<codeline lineno="584"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>we<sp/>have<sp/>to<sp/>check<sp/>the<sp/>pcbs<sp/>in<sp/>TIME-WAIT<sp/>state,<sp/>also.</highlight></codeline>
<codeline lineno="585"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>We<sp/>do<sp/>not<sp/>dump<sp/>TIME_WAIT<sp/>pcb&apos;s;<sp/>they<sp/>can<sp/>still<sp/>be<sp/>matched<sp/>by<sp/>incoming</highlight></codeline>
<codeline lineno="586"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>packets<sp/>using<sp/>both<sp/>local<sp/>and<sp/>remote<sp/>IP<sp/>addresses<sp/>and<sp/>ports<sp/>to<sp/>distinguish.</highlight></codeline>
<codeline lineno="587"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip_8h_1a26e077f52de4a97ff89c02415c084518" kindref="member">ip_get_option</ref>(pcb,<sp/><ref refid="ip_8h_1aa40b3366a7939ec3a60e9a7d239575e2" kindref="member">SOF_REUSEADDR</ref>))<sp/>{</highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/><sp/><sp/>max_pcb_list<sp/>=<sp/>NUM_TCP_PCB_LISTS_NO_TIME_WAIT;</highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="591"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>SO_REUSE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="592"><highlight class="normal"></highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(port<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="594"><highlight class="normal"><sp/><sp/><sp/><sp/>port<sp/>=<sp/>tcp_new_port();</highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(port<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>the<sp/>address<sp/>already<sp/>is<sp/>in<sp/>use<sp/>(on<sp/>all<sp/>lists)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="600"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>max_pcb_list;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="601"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(cpcb<sp/>=<sp/>*tcp_pcb_lists[i];<sp/>cpcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>cpcb<sp/>=<sp/>cpcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="602"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(cpcb-&gt;local_port<sp/>==<sp/>port)<sp/>{</highlight></codeline>
<codeline lineno="603"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>SO_REUSE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Omit<sp/>checking<sp/>for<sp/>the<sp/>same<sp/>port<sp/>if<sp/>both<sp/>pcbs<sp/>have<sp/>REUSEADDR<sp/>set.</highlight></codeline>
<codeline lineno="605"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>For<sp/>SO_REUSEADDR,<sp/>the<sp/>duplicate-check<sp/>for<sp/>a<sp/>5-tuple<sp/>is<sp/>done<sp/>in</highlight></codeline>
<codeline lineno="606"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_connect.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="ip_8h_1a26e077f52de4a97ff89c02415c084518" kindref="member">ip_get_option</ref>(pcb,<sp/><ref refid="ip_8h_1aa40b3366a7939ec3a60e9a7d239575e2" kindref="member">SOF_REUSEADDR</ref>)<sp/>||</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>!<ref refid="ip_8h_1a26e077f52de4a97ff89c02415c084518" kindref="member">ip_get_option</ref>(cpcb,<sp/><ref refid="ip_8h_1aa40b3366a7939ec3a60e9a7d239575e2" kindref="member">SOF_REUSEADDR</ref>))</highlight></codeline>
<codeline lineno="609"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>SO_REUSE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>check<sp/>accept_any_ip_version<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="612"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="ip__addr_8h_1a9bac7e938757f1d24df2404e8b57cb7d" kindref="member">IP_IS_V6</ref>(ipaddr)<sp/>==<sp/><ref refid="ip__addr_8h_1a1578e34703e86711a7fb7dcc3857004d" kindref="member">IP_IS_V6_VAL</ref>(cpcb-&gt;local_ip))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(&amp;cpcb-&gt;local_ip)<sp/>||</highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(ipaddr)<sp/>||</highlight></codeline>
<codeline lineno="615"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&amp;cpcb-&gt;local_ip,<sp/>ipaddr)))<sp/>{</highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca4ebdc2aa1dbd75f927845733a3fb1f8b" kindref="member">ERR_USE</ref>;</highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="623"><highlight class="normal"></highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(ipaddr))<sp/>{</highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&amp;pcb-&gt;local_ip,<sp/>ipaddr);</highlight></codeline>
<codeline lineno="626"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/>pcb-&gt;local_port<sp/>=<sp/>port;</highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/>TCP_REG(&amp;tcp_bound_pcbs,<sp/>pcb);</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_bind:<sp/>bind<sp/>to<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>port));</highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="631"><highlight class="normal">}</highlight></codeline>
<codeline lineno="632"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="633"><highlight class="normal"></highlight></codeline>
<codeline lineno="636"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="637"><highlight class="normal">tcp_accept_null(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err)</highlight></codeline>
<codeline lineno="638"><highlight class="normal">{</highlight></codeline>
<codeline lineno="639"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(arg);</highlight></codeline>
<codeline lineno="640"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(err);</highlight></codeline>
<codeline lineno="641"><highlight class="normal"></highlight></codeline>
<codeline lineno="642"><highlight class="normal"><sp/><sp/>tcp_abort(pcb);</highlight></codeline>
<codeline lineno="643"><highlight class="normal"></highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaf316b2c5eee4079820f7100849115142" kindref="member">ERR_ABRT</ref>;</highlight></codeline>
<codeline lineno="645"><highlight class="normal">}</highlight></codeline>
<codeline lineno="646"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="647"><highlight class="normal"></highlight></codeline>
<codeline lineno="663"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*</highlight></codeline>
<codeline lineno="664"><highlight class="normal">tcp_listen_with_backlog(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>backlog)</highlight></codeline>
<codeline lineno="665"><highlight class="normal">{</highlight></codeline>
<codeline lineno="666"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_listen_with_backlog_and_err(pcb,<sp/>backlog,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="667"><highlight class="normal">}</highlight></codeline>
<codeline lineno="668"><highlight class="normal"></highlight></codeline>
<codeline lineno="685"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*</highlight></codeline>
<codeline lineno="686"><highlight class="normal">tcp_listen_with_backlog_and_err(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>backlog,<sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>*err)</highlight></codeline>
<codeline lineno="687"><highlight class="normal">{</highlight></codeline>
<codeline lineno="688"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb_listen<sp/>*lpcb<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="689"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>res;</highlight></codeline>
<codeline lineno="690"><highlight class="normal"></highlight></codeline>
<codeline lineno="691"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(backlog);</highlight></codeline>
<codeline lineno="692"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;tcp_listen:<sp/>pcb<sp/>already<sp/>connected&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>==<sp/>CLOSED,<sp/>res<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa5176d9fecf8ec43d3bc49f4e6c3f7f5" kindref="member">ERR_CLSD</ref>;<sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>done);</highlight></codeline>
<codeline lineno="693"><highlight class="normal"></highlight></codeline>
<codeline lineno="694"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>already<sp/>listening?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="695"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>LISTEN)<sp/>{</highlight></codeline>
<codeline lineno="696"><highlight class="normal"><sp/><sp/><sp/><sp/>lpcb<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb_listen*)pcb;</highlight></codeline>
<codeline lineno="697"><highlight class="normal"><sp/><sp/><sp/><sp/>res<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcae6f9c1e4c18ca844f7934307d4cc30e5" kindref="member">ERR_ALREADY</ref>;</highlight></codeline>
<codeline lineno="698"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>done;</highlight></codeline>
<codeline lineno="699"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="700"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>SO_REUSE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip_8h_1a26e077f52de4a97ff89c02415c084518" kindref="member">ip_get_option</ref>(pcb,<sp/><ref refid="ip_8h_1aa40b3366a7939ec3a60e9a7d239575e2" kindref="member">SOF_REUSEADDR</ref>))<sp/>{</highlight></codeline>
<codeline lineno="702"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Since<sp/>SOF_REUSEADDR<sp/>allows<sp/>reusing<sp/>a<sp/>local<sp/>address<sp/>before<sp/>the<sp/>pcb&apos;s<sp/>usage</highlight></codeline>
<codeline lineno="703"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>is<sp/>declared<sp/>(listen-/connection-pcb),<sp/>we<sp/>have<sp/>to<sp/>make<sp/>sure<sp/>now<sp/>that</highlight></codeline>
<codeline lineno="704"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>this<sp/>port<sp/>is<sp/>only<sp/>used<sp/>once<sp/>for<sp/>every<sp/>local<sp/>IP.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="705"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(lpcb<sp/>=<sp/>tcp_listen_pcbs.listen_pcbs;<sp/>lpcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>lpcb<sp/>=<sp/>lpcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="706"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((lpcb-&gt;local_port<sp/>==<sp/>pcb-&gt;local_port)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="707"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&amp;lpcb-&gt;local_ip,<sp/>&amp;pcb-&gt;local_ip))<sp/>{</highlight></codeline>
<codeline lineno="708"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>address/port<sp/>is<sp/>already<sp/>used<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lpcb<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>res<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca4ebdc2aa1dbd75f927845733a3fb1f8b" kindref="member">ERR_USE</ref>;</highlight></codeline>
<codeline lineno="711"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>done;</highlight></codeline>
<codeline lineno="712"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="713"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="715"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>SO_REUSE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="716"><highlight class="normal"><sp/><sp/>lpcb<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb_listen<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_TCP_PCB_LISTEN);</highlight></codeline>
<codeline lineno="717"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(lpcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/><sp/><sp/>res<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="719"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>done;</highlight></codeline>
<codeline lineno="720"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/>lpcb-&gt;callback_arg<sp/>=<sp/>pcb-&gt;callback_arg;</highlight></codeline>
<codeline lineno="722"><highlight class="normal"><sp/><sp/>lpcb-&gt;local_port<sp/>=<sp/>pcb-&gt;local_port;</highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/>lpcb-&gt;state<sp/>=<sp/>LISTEN;</highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/>lpcb-&gt;prio<sp/>=<sp/>pcb-&gt;prio;</highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/>lpcb-&gt;so_options<sp/>=<sp/>pcb-&gt;so_options;</highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/>lpcb-&gt;ttl<sp/>=<sp/>pcb-&gt;ttl;</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/>lpcb-&gt;tos<sp/>=<sp/>pcb-&gt;tos;</highlight></codeline>
<codeline lineno="728"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1aaa800ce1929a1bb0f3d64bebd44e4051" kindref="member">IP_SET_TYPE_VAL</ref>(lpcb-&gt;remote_ip,<sp/>pcb-&gt;local_ip.type);</highlight></codeline>
<codeline lineno="730"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="731"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a77a933975db287f6aa5c2e70249ba18f" kindref="member">ip_addr_copy</ref>(lpcb-&gt;local_ip,<sp/>pcb-&gt;local_ip);</highlight></codeline>
<codeline lineno="732"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;local_port<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/><sp/><sp/>TCP_RMV(&amp;tcp_bound_pcbs,<sp/>pcb);</highlight></codeline>
<codeline lineno="734"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB,<sp/>pcb);</highlight></codeline>
<codeline lineno="736"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/>lpcb-&gt;accept<sp/>=<sp/>tcp_accept_null;</highlight></codeline>
<codeline lineno="738"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="739"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/>lpcb-&gt;accepts_pending<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/>tcp_backlog_set(lpcb,<sp/>backlog);</highlight></codeline>
<codeline lineno="742"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/>TCP_REG(&amp;tcp_listen_pcbs.pcbs,<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*)lpcb);</highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/>res<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="745"><highlight class="normal">done:</highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/><sp/><sp/>*err<sp/>=<sp/>res;</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*)lpcb;</highlight></codeline>
<codeline lineno="750"><highlight class="normal">}</highlight></codeline>
<codeline lineno="751"><highlight class="normal"></highlight></codeline>
<codeline lineno="758"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref></highlight></codeline>
<codeline lineno="759"><highlight class="normal">tcp_update_rcv_ann_wnd(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="760"><highlight class="normal">{</highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>new_right_edge<sp/>=<sp/>pcb-&gt;rcv_nxt<sp/>+<sp/>pcb-&gt;rcv_wnd;</highlight></codeline>
<codeline lineno="762"><highlight class="normal"></highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(TCP_SEQ_GEQ(new_right_edge,<sp/>pcb-&gt;rcv_ann_right_edge<sp/>+<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>((<ref refid="lwipopts_8h_1a7f535a6efb5cdf86c3210e35ece1d6a7" kindref="member">TCP_WND</ref><sp/>/<sp/>2),<sp/>pcb-&gt;mss)))<sp/>{</highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>we<sp/>can<sp/>advertise<sp/>more<sp/>window<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;rcv_ann_wnd<sp/>=<sp/>pcb-&gt;rcv_wnd;</highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>new_right_edge<sp/>-<sp/>pcb-&gt;rcv_ann_right_edge;</highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(TCP_SEQ_GT(pcb-&gt;rcv_nxt,<sp/>pcb-&gt;rcv_ann_right_edge))<sp/>{</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Can<sp/>happen<sp/>due<sp/>to<sp/>other<sp/>end<sp/>sending<sp/>out<sp/>of<sp/>advertised<sp/>window,</highlight></codeline>
<codeline lineno="770"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>but<sp/>within<sp/>actual<sp/>available<sp/>(but<sp/>not<sp/>yet<sp/>advertised)<sp/>window<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="771"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;rcv_ann_wnd<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>keep<sp/>the<sp/>right<sp/>edge<sp/>of<sp/>window<sp/>constant<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>new_rcv_ann_wnd<sp/>=<sp/>pcb-&gt;rcv_ann_right_edge<sp/>-<sp/>pcb-&gt;rcv_nxt;</highlight></codeline>
<codeline lineno="775"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_WND_SCALE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;new_rcv_ann_wnd<sp/>&lt;=<sp/>0xffff&quot;</highlight><highlight class="normal">,<sp/>new_rcv_ann_wnd<sp/>&lt;=<sp/>0xffff);</highlight></codeline>
<codeline lineno="777"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;rcv_ann_wnd<sp/>=<sp/>(tcpwnd_size_t)new_rcv_ann_wnd;</highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="782"><highlight class="normal">}</highlight></codeline>
<codeline lineno="783"><highlight class="normal"></highlight></codeline>
<codeline lineno="793"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="794"><highlight class="normal">tcp_recved(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>len)</highlight></codeline>
<codeline lineno="795"><highlight class="normal">{</highlight></codeline>
<codeline lineno="796"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>wnd_inflation;</highlight></codeline>
<codeline lineno="797"><highlight class="normal"></highlight></codeline>
<codeline lineno="798"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pcb-&gt;state<sp/>LISTEN<sp/>not<sp/>allowed<sp/>here<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="799"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;don&apos;t<sp/>call<sp/>tcp_recved<sp/>for<sp/>listen-pcbs&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="800"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN);</highlight></codeline>
<codeline lineno="801"><highlight class="normal"></highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/>pcb-&gt;rcv_wnd<sp/>+=<sp/>len;</highlight></codeline>
<codeline lineno="803"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;rcv_wnd<sp/>&gt;<sp/>TCP_WND_MAX(pcb))<sp/>{</highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;rcv_wnd<sp/>=<sp/>TCP_WND_MAX(pcb);</highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;rcv_wnd<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="806"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>rcv_wnd<sp/>overflowed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="807"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((pcb-&gt;state<sp/>==<sp/>CLOSE_WAIT)<sp/>||<sp/>(pcb-&gt;state<sp/>==<sp/>LAST_ACK))<sp/>{</highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>In<sp/>passive<sp/>close,<sp/>we<sp/>allow<sp/>this,<sp/>since<sp/>the<sp/>FIN<sp/>bit<sp/>is<sp/>added<sp/>to<sp/>rcv_wnd</highlight></codeline>
<codeline lineno="809"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>by<sp/>the<sp/>stack<sp/>itself,<sp/>since<sp/>it<sp/>is<sp/>not<sp/>mandatory<sp/>for<sp/>an<sp/>application</highlight></codeline>
<codeline lineno="810"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>to<sp/>call<sp/>tcp_recved()<sp/>for<sp/>the<sp/>FIN<sp/>bit,<sp/>but<sp/>e.g.<sp/>the<sp/>netconn<sp/>API<sp/>does<sp/>so.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="811"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;rcv_wnd<sp/>=<sp/>TCP_WND_MAX(pcb);</highlight></codeline>
<codeline lineno="812"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_recved:<sp/>len<sp/>wrapped<sp/>rcv_wnd\n&quot;</highlight><highlight class="normal">,<sp/>0);</highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="816"><highlight class="normal"></highlight></codeline>
<codeline lineno="817"><highlight class="normal"><sp/><sp/>wnd_inflation<sp/>=<sp/>tcp_update_rcv_ann_wnd(pcb);</highlight></codeline>
<codeline lineno="818"><highlight class="normal"></highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>the<sp/>change<sp/>in<sp/>the<sp/>right<sp/>edge<sp/>of<sp/>window<sp/>is<sp/>significant<sp/>(default</highlight></codeline>
<codeline lineno="820"><highlight class="comment"><sp/><sp/><sp/>*<sp/>watermark<sp/>is<sp/>TCP_WND/4),<sp/>then<sp/>send<sp/>an<sp/>explicit<sp/>update<sp/>now.</highlight></codeline>
<codeline lineno="821"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Otherwise<sp/>wait<sp/>for<sp/>a<sp/>packet<sp/>to<sp/>be<sp/>sent<sp/>in<sp/>the<sp/>normal<sp/>course<sp/>of</highlight></codeline>
<codeline lineno="822"><highlight class="comment"><sp/><sp/><sp/>*<sp/>events<sp/>(or<sp/>more<sp/>window<sp/>to<sp/>be<sp/>available<sp/>later)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="823"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(wnd_inflation<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a5d45732ba3a8438b141096d86e07ef8d" kindref="member">TCP_WND_UPDATE_THRESHOLD</ref>)<sp/>{</highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_ack_now(pcb);</highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_output(pcb);</highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="827"><highlight class="normal"></highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_recved:<sp/>received<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>bytes,<sp/>wnd<sp/>%&quot;</highlight><highlight class="normal">TCPWNDSIZE_F</highlight><highlight class="stringliteral">&quot;<sp/>(%&quot;</highlight><highlight class="normal">TCPWNDSIZE_F</highlight><highlight class="stringliteral">&quot;).\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="829"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>len,<sp/>pcb-&gt;rcv_wnd,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(TCP_WND_MAX(pcb)<sp/>-<sp/>pcb-&gt;rcv_wnd)));</highlight></codeline>
<codeline lineno="830"><highlight class="normal">}</highlight></codeline>
<codeline lineno="831"><highlight class="normal"></highlight></codeline>
<codeline lineno="837"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="838"><highlight class="normal">tcp_new_port(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="839"><highlight class="normal">{</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="841"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>n<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb;</highlight></codeline>
<codeline lineno="843"><highlight class="normal"></highlight></codeline>
<codeline lineno="844"><highlight class="normal">again:</highlight></codeline>
<codeline lineno="845"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tcp_port++<sp/>==<sp/>TCP_LOCAL_PORT_RANGE_END)<sp/>{</highlight></codeline>
<codeline lineno="846"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_port<sp/>=<sp/>TCP_LOCAL_PORT_RANGE_START;</highlight></codeline>
<codeline lineno="847"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="848"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>all<sp/>PCB<sp/>lists.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="849"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>NUM_TCP_PCB_LISTS;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="850"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>*tcp_pcb_lists[i];<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="851"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;local_port<sp/>==<sp/>tcp_port)<sp/>{</highlight></codeline>
<codeline lineno="852"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(++n<sp/>&gt;<sp/>(TCP_LOCAL_PORT_RANGE_END<sp/>-<sp/>TCP_LOCAL_PORT_RANGE_START))<sp/>{</highlight></codeline>
<codeline lineno="853"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="854"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="855"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>again;</highlight></codeline>
<codeline lineno="856"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="857"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="858"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="859"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_port;</highlight></codeline>
<codeline lineno="860"><highlight class="normal">}</highlight></codeline>
<codeline lineno="861"><highlight class="normal"></highlight></codeline>
<codeline lineno="876"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="877"><highlight class="normal">tcp_connect(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*ipaddr,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>port,</highlight></codeline>
<codeline lineno="878"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_connected_fn<sp/>connected)</highlight></codeline>
<codeline lineno="879"><highlight class="normal">{</highlight></codeline>
<codeline lineno="880"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>ret;</highlight></codeline>
<codeline lineno="881"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>iss;</highlight></codeline>
<codeline lineno="882"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>old_local_port;</highlight></codeline>
<codeline lineno="883"><highlight class="normal"></highlight></codeline>
<codeline lineno="884"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(ipaddr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="885"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;</highlight></codeline>
<codeline lineno="886"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="887"><highlight class="normal"></highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;tcp_connect:<sp/>can<sp/>only<sp/>connect<sp/>from<sp/>state<sp/>CLOSED&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>==<sp/>CLOSED,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca8543e1d6422fed7b318d97e08dcbaa33" kindref="member">ERR_ISCONN</ref>);</highlight></codeline>
<codeline lineno="889"><highlight class="normal"></highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_connect<sp/>to<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>port));</highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&amp;pcb-&gt;remote_ip,<sp/>ipaddr);</highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/>pcb-&gt;remote_port<sp/>=<sp/>port;</highlight></codeline>
<codeline lineno="893"><highlight class="normal"></highlight></codeline>
<codeline lineno="894"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>if<sp/>we<sp/>have<sp/>a<sp/>route<sp/>to<sp/>the<sp/>remote<sp/>host<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="895"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(&amp;pcb-&gt;local_ip))<sp/>{</highlight></codeline>
<codeline lineno="896"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>local<sp/>IP<sp/>address<sp/>set,<sp/>yet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="897"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="898"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*local_ip;</highlight></codeline>
<codeline lineno="899"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip_8h_1ae392fc1ebc42a4b08f73d42c04089be9" kindref="member">ip_route_get_local_ip</ref>(&amp;pcb-&gt;local_ip,<sp/>&amp;pcb-&gt;remote_ip,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/>local_ip);</highlight></codeline>
<codeline lineno="900"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(local_ip<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="901"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>even<sp/>try<sp/>to<sp/>send<sp/>a<sp/>SYN<sp/>packet<sp/>if<sp/>we<sp/>have<sp/>no<sp/>route</highlight></codeline>
<codeline lineno="902"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>since<sp/>that<sp/>will<sp/>fail.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="903"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca9448893187313c0c5a502ca9a9ad1c2a" kindref="member">ERR_RTE</ref>;</highlight></codeline>
<codeline lineno="904"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="905"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Use<sp/>the<sp/>address<sp/>as<sp/>local<sp/>address<sp/>of<sp/>the<sp/>pcb.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="906"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a77a933975db287f6aa5c2e70249ba18f" kindref="member">ip_addr_copy</ref>(pcb-&gt;local_ip,<sp/>*local_ip);</highlight></codeline>
<codeline lineno="907"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="908"><highlight class="normal"></highlight></codeline>
<codeline lineno="909"><highlight class="normal"><sp/><sp/>old_local_port<sp/>=<sp/>pcb-&gt;local_port;</highlight></codeline>
<codeline lineno="910"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;local_port<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="911"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;local_port<sp/>=<sp/>tcp_new_port();</highlight></codeline>
<codeline lineno="912"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;local_port<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="913"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="914"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="915"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="916"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>SO_REUSE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="917"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip_8h_1a26e077f52de4a97ff89c02415c084518" kindref="member">ip_get_option</ref>(pcb,<sp/><ref refid="ip_8h_1aa40b3366a7939ec3a60e9a7d239575e2" kindref="member">SOF_REUSEADDR</ref>))<sp/>{</highlight></codeline>
<codeline lineno="918"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Since<sp/>SOF_REUSEADDR<sp/>allows<sp/>reusing<sp/>a<sp/>local<sp/>address,<sp/>we<sp/>have<sp/>to<sp/>make<sp/>sure</highlight></codeline>
<codeline lineno="919"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>now<sp/>that<sp/>the<sp/>5-tuple<sp/>is<sp/>unique.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="920"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*cpcb;</highlight></codeline>
<codeline lineno="921"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="922"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>check<sp/>listen-<sp/>and<sp/>bound-PCBs,<sp/>check<sp/>active-<sp/>and<sp/>TIME-WAIT<sp/>PCBs.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="923"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>2;<sp/>i<sp/>&lt;<sp/>NUM_TCP_PCB_LISTS;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="924"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(cpcb<sp/>=<sp/>*tcp_pcb_lists[i];<sp/>cpcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>cpcb<sp/>=<sp/>cpcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="925"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((cpcb-&gt;local_port<sp/>==<sp/>pcb-&gt;local_port)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(cpcb-&gt;remote_port<sp/>==<sp/>port)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="927"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&amp;cpcb-&gt;local_ip,<sp/>&amp;pcb-&gt;local_ip)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="928"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&amp;cpcb-&gt;remote_ip,<sp/>ipaddr))<sp/>{</highlight></codeline>
<codeline lineno="929"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>linux<sp/>returns<sp/>EISCONN<sp/>here,<sp/>but<sp/>ERR_USE<sp/>should<sp/>be<sp/>OK<sp/>for<sp/>us<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="930"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca4ebdc2aa1dbd75f927845733a3fb1f8b" kindref="member">ERR_USE</ref>;</highlight></codeline>
<codeline lineno="931"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="932"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="933"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="935"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>SO_REUSE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="936"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="937"><highlight class="normal"></highlight></codeline>
<codeline lineno="938"><highlight class="normal"><sp/><sp/>iss<sp/>=<sp/>tcp_next_iss(pcb);</highlight></codeline>
<codeline lineno="939"><highlight class="normal"><sp/><sp/>pcb-&gt;rcv_nxt<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="940"><highlight class="normal"><sp/><sp/>pcb-&gt;snd_nxt<sp/>=<sp/>iss;</highlight></codeline>
<codeline lineno="941"><highlight class="normal"><sp/><sp/>pcb-&gt;lastack<sp/>=<sp/>iss<sp/>-<sp/>1;</highlight></codeline>
<codeline lineno="942"><highlight class="normal"><sp/><sp/>pcb-&gt;snd_wl2<sp/>=<sp/>iss<sp/>-<sp/>1;</highlight></codeline>
<codeline lineno="943"><highlight class="normal"><sp/><sp/>pcb-&gt;snd_lbb<sp/>=<sp/>iss<sp/>-<sp/>1;</highlight></codeline>
<codeline lineno="944"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Start<sp/>with<sp/>a<sp/>window<sp/>that<sp/>does<sp/>not<sp/>need<sp/>scaling.<sp/>When<sp/>window<sp/>scaling<sp/>is</highlight></codeline>
<codeline lineno="945"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>enabled<sp/>and<sp/>used,<sp/>the<sp/>window<sp/>is<sp/>enlarged<sp/>when<sp/>both<sp/>sides<sp/>agree<sp/>on<sp/>scaling.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="946"><highlight class="normal"><sp/><sp/>pcb-&gt;rcv_wnd<sp/>=<sp/>pcb-&gt;rcv_ann_wnd<sp/>=<sp/>TCPWND_MIN16(<ref refid="lwipopts_8h_1a7f535a6efb5cdf86c3210e35ece1d6a7" kindref="member">TCP_WND</ref>);</highlight></codeline>
<codeline lineno="947"><highlight class="normal"><sp/><sp/>pcb-&gt;rcv_ann_right_edge<sp/>=<sp/>pcb-&gt;rcv_nxt;</highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/>pcb-&gt;snd_wnd<sp/>=<sp/><ref refid="lwipopts_8h_1a7f535a6efb5cdf86c3210e35ece1d6a7" kindref="member">TCP_WND</ref>;</highlight></codeline>
<codeline lineno="949"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>As<sp/>initial<sp/>send<sp/>MSS,<sp/>we<sp/>use<sp/>TCP_MSS<sp/>but<sp/>limit<sp/>it<sp/>to<sp/>536.</highlight></codeline>
<codeline lineno="950"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>The<sp/>send<sp/>MSS<sp/>is<sp/>updated<sp/>when<sp/>an<sp/>MSS<sp/>option<sp/>is<sp/>received.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="951"><highlight class="normal"><sp/><sp/>pcb-&gt;mss<sp/>=<sp/>INITIAL_MSS;</highlight></codeline>
<codeline lineno="952"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_CALCULATE_EFF_SEND_MSS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="953"><highlight class="normal"><sp/><sp/>pcb-&gt;mss<sp/>=<sp/>tcp_eff_send_mss(pcb-&gt;mss,<sp/>&amp;pcb-&gt;local_ip,<sp/>&amp;pcb-&gt;remote_ip);</highlight></codeline>
<codeline lineno="954"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_CALCULATE_EFF_SEND_MSS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="955"><highlight class="normal"><sp/><sp/>pcb-&gt;cwnd<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="956"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="957"><highlight class="normal"><sp/><sp/>pcb-&gt;connected<sp/>=<sp/>connected;</highlight></codeline>
<codeline lineno="958"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="959"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(connected);</highlight></codeline>
<codeline lineno="960"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="961"><highlight class="normal"></highlight></codeline>
<codeline lineno="962"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>a<sp/>SYN<sp/>together<sp/>with<sp/>the<sp/>MSS<sp/>option.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="963"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>tcp_enqueue_flags(pcb,<sp/><ref refid="prot_2tcp_8h_1a6020613f5062417d9811cfa837215c83" kindref="member">TCP_SYN</ref>);</highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>SYN<sp/>segment<sp/>was<sp/>enqueued,<sp/>changed<sp/>the<sp/>pcbs<sp/>state<sp/>now<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>=<sp/>SYN_SENT;</highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(old_local_port<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="968"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>TCP_RMV(&amp;tcp_bound_pcbs,<sp/>pcb);</highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/><sp/><sp/>TCP_REG_ACTIVE(pcb);</highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.tcpactiveopens);</highlight></codeline>
<codeline lineno="972"><highlight class="normal"></highlight></codeline>
<codeline lineno="973"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_output(pcb);</highlight></codeline>
<codeline lineno="974"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="975"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="976"><highlight class="normal">}</highlight></codeline>
<codeline lineno="977"><highlight class="normal"></highlight></codeline>
<codeline lineno="985"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="986"><highlight class="normal">tcp_slowtmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="987"><highlight class="normal">{</highlight></codeline>
<codeline lineno="988"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb,<sp/>*prev;</highlight></codeline>
<codeline lineno="989"><highlight class="normal"><sp/><sp/>tcpwnd_size_t<sp/>eff_wnd;</highlight></codeline>
<codeline lineno="990"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>pcb_remove;<sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>flag<sp/>if<sp/>a<sp/>PCB<sp/>should<sp/>be<sp/>removed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="991"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>pcb_reset;<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>flag<sp/>if<sp/>a<sp/>RST<sp/>should<sp/>be<sp/>sent<sp/>when<sp/>removing<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="993"><highlight class="normal"></highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="995"><highlight class="normal"></highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/>++tcp_ticks;</highlight></codeline>
<codeline lineno="997"><highlight class="normal"><sp/><sp/>++tcp_timer_ctr;</highlight></codeline>
<codeline lineno="998"><highlight class="normal"></highlight></codeline>
<codeline lineno="999"><highlight class="normal">tcp_slowtmr_start:</highlight></codeline>
<codeline lineno="1000"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Steps<sp/>through<sp/>all<sp/>of<sp/>the<sp/>active<sp/>PCBs.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1001"><highlight class="normal"><sp/><sp/>prev<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1002"><highlight class="normal"><sp/><sp/>pcb<sp/>=<sp/>tcp_active_pcbs;</highlight></codeline>
<codeline lineno="1003"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1004"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>no<sp/>active<sp/>pcbs\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1005"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1006"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1007"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>processing<sp/>active<sp/>pcb\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1008"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>active<sp/>pcb-&gt;state<sp/>!=<sp/>CLOSED\n&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>CLOSED);</highlight></codeline>
<codeline lineno="1009"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>active<sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN\n&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN);</highlight></codeline>
<codeline lineno="1010"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>active<sp/>pcb-&gt;state<sp/>!=<sp/>TIME-WAIT\n&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>TIME_WAIT);</highlight></codeline>
<codeline lineno="1011"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;last_timer<sp/>==<sp/>tcp_timer_ctr)<sp/>{</highlight></codeline>
<codeline lineno="1012"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>skip<sp/>this<sp/>pcb,<sp/>we<sp/>have<sp/>already<sp/>processed<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1013"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1014"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">continue</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1015"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1016"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;last_timer<sp/>=<sp/>tcp_timer_ctr;</highlight></codeline>
<codeline lineno="1017"><highlight class="normal"></highlight></codeline>
<codeline lineno="1018"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb_remove<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1019"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb_reset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1020"><highlight class="normal"></highlight></codeline>
<codeline lineno="1021"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>SYN_SENT<sp/>&amp;&amp;<sp/>pcb-&gt;nrtx<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a50b434a8541a4813f7b27f576c05d1b6" kindref="member">TCP_SYNMAXRTX</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1022"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>++pcb_remove;</highlight></codeline>
<codeline lineno="1023"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>max<sp/>SYN<sp/>retries<sp/>reached\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1024"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1025"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;nrtx<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a0dee0911197855bdf19ef79778c241a6" kindref="member">TCP_MAXRTX</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1026"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>++pcb_remove;</highlight></codeline>
<codeline lineno="1027"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>max<sp/>DATA<sp/>retries<sp/>reached\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1028"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1029"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;persist_backoff<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1030"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>snd_wnd<sp/>is<sp/>zero,<sp/>use<sp/>persist<sp/>timer<sp/>to<sp/>send<sp/>1<sp/>byte<sp/>probes</highlight></codeline>
<codeline lineno="1031"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>instead<sp/>of<sp/>using<sp/>the<sp/>standard<sp/>retransmission<sp/>mechanism.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>backoff_cnt<sp/>=<sp/>tcp_persist_backoff[pcb-&gt;persist_backoff-1];</highlight></codeline>
<codeline lineno="1033"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;persist_cnt<sp/>&lt;<sp/>backoff_cnt)<sp/>{</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;persist_cnt++;</highlight></codeline>
<codeline lineno="1035"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1036"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;persist_cnt<sp/>&gt;=<sp/>backoff_cnt)<sp/>{</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tcp_zero_window_probe(pcb)<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1038"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;persist_cnt<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1039"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;persist_backoff<sp/>&lt;<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(tcp_persist_backoff))<sp/>{</highlight></codeline>
<codeline lineno="1040"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;persist_backoff++;</highlight></codeline>
<codeline lineno="1041"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1042"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1043"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1044"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1045"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Increase<sp/>the<sp/>retransmission<sp/>timer<sp/>if<sp/>it<sp/>is<sp/>running<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1046"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;rtime<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1047"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++pcb-&gt;rtime;</highlight></codeline>
<codeline lineno="1048"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1049"><highlight class="normal"></highlight></codeline>
<codeline lineno="1050"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;unacked<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>&amp;&amp;<sp/>pcb-&gt;rtime<sp/>&gt;=<sp/>pcb-&gt;rto)<sp/>{</highlight></codeline>
<codeline lineno="1051"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Time<sp/>for<sp/>a<sp/>retransmission.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1052"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1ad6e52e37415d0d0cbe4931a28f5a9662" kindref="member">TCP_RTO_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>rtime<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight></codeline>
<codeline lineno="1053"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;<sp/>pcb-&gt;rto<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1054"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;rtime,<sp/>pcb-&gt;rto));</highlight></codeline>
<codeline lineno="1055"><highlight class="normal"></highlight></codeline>
<codeline lineno="1056"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Double<sp/>retransmission<sp/>time-out<sp/>unless<sp/>we<sp/>are<sp/>trying<sp/>to</highlight></codeline>
<codeline lineno="1057"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>connect<sp/>to<sp/>somebody<sp/>(i.e.,<sp/>we<sp/>are<sp/>in<sp/>SYN_SENT).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1058"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>!=<sp/>SYN_SENT)<sp/>{</highlight></codeline>
<codeline lineno="1059"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>backoff_idx<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(pcb-&gt;nrtx,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(tcp_backoff)-1);</highlight></codeline>
<codeline lineno="1060"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;rto<sp/>=<sp/>((pcb-&gt;sa<sp/>&gt;&gt;<sp/>3)<sp/>+<sp/>pcb-&gt;sv)<sp/>&lt;&lt;<sp/>tcp_backoff[backoff_idx];</highlight></codeline>
<codeline lineno="1061"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1062"><highlight class="normal"></highlight></codeline>
<codeline lineno="1063"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Reset<sp/>the<sp/>retransmission<sp/>timer.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1064"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;rtime<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1065"><highlight class="normal"></highlight></codeline>
<codeline lineno="1066"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Reduce<sp/>congestion<sp/>window<sp/>and<sp/>ssthresh.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1067"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>eff_wnd<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(pcb-&gt;cwnd,<sp/>pcb-&gt;snd_wnd);</highlight></codeline>
<codeline lineno="1068"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;ssthresh<sp/>=<sp/>eff_wnd<sp/>&gt;&gt;<sp/>1;</highlight></codeline>
<codeline lineno="1069"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;ssthresh<sp/>&lt;<sp/>(tcpwnd_size_t)(pcb-&gt;mss<sp/>&lt;&lt;<sp/>1))<sp/>{</highlight></codeline>
<codeline lineno="1070"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;ssthresh<sp/>=<sp/>(pcb-&gt;mss<sp/>&lt;&lt;<sp/>1);</highlight></codeline>
<codeline lineno="1071"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1072"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;cwnd<sp/>=<sp/>pcb-&gt;mss;</highlight></codeline>
<codeline lineno="1073"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a66df03d8192cd978d3321a9d68bf5411" kindref="member">TCP_CWND_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>cwnd<sp/>%&quot;</highlight><highlight class="normal">TCPWNDSIZE_F</highlight></codeline>
<codeline lineno="1074"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;<sp/>ssthresh<sp/>%&quot;</highlight><highlight class="normal">TCPWNDSIZE_F</highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1075"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;cwnd,<sp/>pcb-&gt;ssthresh));</highlight></codeline>
<codeline lineno="1076"><highlight class="normal"></highlight></codeline>
<codeline lineno="1077"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>The<sp/>following<sp/>needs<sp/>to<sp/>be<sp/>called<sp/>AFTER<sp/>cwnd<sp/>is<sp/>set<sp/>to<sp/>one</highlight></codeline>
<codeline lineno="1078"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mss<sp/>-<sp/>STJ<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1079"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_rexmit_rto(pcb);</highlight></codeline>
<codeline lineno="1080"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1081"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1082"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1083"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>this<sp/>PCB<sp/>has<sp/>stayed<sp/>too<sp/>long<sp/>in<sp/>FIN-WAIT-2<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1084"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>FIN_WAIT_2)<sp/>{</highlight></codeline>
<codeline lineno="1085"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>this<sp/>PCB<sp/>is<sp/>in<sp/>FIN_WAIT_2<sp/>because<sp/>of<sp/>SHUT_WR<sp/>don&apos;t<sp/>let<sp/>it<sp/>time<sp/>out.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1086"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;flags<sp/>&amp;<sp/>TF_RXCLOSED)<sp/>{</highlight></codeline>
<codeline lineno="1087"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>PCB<sp/>was<sp/>fully<sp/>closed<sp/>(either<sp/>through<sp/>close()<sp/>or<sp/>SHUT_RDWR):</highlight></codeline>
<codeline lineno="1088"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>normal<sp/>FIN-WAIT<sp/>timeout<sp/>handling.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1089"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;</highlight></codeline>
<codeline lineno="1090"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>TCP_FIN_WAIT_TIMEOUT<sp/>/<sp/>TCP_SLOW_INTERVAL)<sp/>{</highlight></codeline>
<codeline lineno="1091"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++pcb_remove;</highlight></codeline>
<codeline lineno="1092"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>removing<sp/>pcb<sp/>stuck<sp/>in<sp/>FIN-WAIT-2\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1093"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1094"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1095"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1096"><highlight class="normal"></highlight></codeline>
<codeline lineno="1097"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>KEEPALIVE<sp/>should<sp/>be<sp/>sent<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1098"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip_8h_1a26e077f52de4a97ff89c02415c084518" kindref="member">ip_get_option</ref>(pcb,<sp/><ref refid="ip_8h_1a1f7f7efb095c77c06af5c5e8ba558d45" kindref="member">SOF_KEEPALIVE</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1099"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((pcb-&gt;state<sp/>==<sp/>ESTABLISHED)<sp/>||</highlight></codeline>
<codeline lineno="1100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(pcb-&gt;state<sp/>==<sp/>CLOSE_WAIT)))<sp/>{</highlight></codeline>
<codeline lineno="1101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;</highlight></codeline>
<codeline lineno="1102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(pcb-&gt;keep_idle<sp/>+<sp/>TCP_KEEP_DUR(pcb))<sp/>/<sp/>TCP_SLOW_INTERVAL)</highlight></codeline>
<codeline lineno="1103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="1104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>KEEPALIVE<sp/>timeout.<sp/>Aborting<sp/>connection<sp/>to<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1af7d84bce2fb861a97f3047ecd69ab018" kindref="member">ip_addr_debug_print</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>&amp;pcb-&gt;remote_ip);</highlight></codeline>
<codeline lineno="1106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1107"><highlight class="normal"></highlight></codeline>
<codeline lineno="1108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++pcb_remove;</highlight></codeline>
<codeline lineno="1109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++pcb_reset;</highlight></codeline>
<codeline lineno="1110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;</highlight></codeline>
<codeline lineno="1111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(pcb-&gt;keep_idle<sp/>+<sp/>pcb-&gt;keep_cnt_sent<sp/>*<sp/>TCP_KEEP_INTVL(pcb))</highlight></codeline>
<codeline lineno="1112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>/<sp/>TCP_SLOW_INTERVAL)</highlight></codeline>
<codeline lineno="1113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="1114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>err<sp/>=<sp/>tcp_keepalive(pcb);</highlight></codeline>
<codeline lineno="1115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;keep_cnt_sent++;</highlight></codeline>
<codeline lineno="1117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1119"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1120"><highlight class="normal"></highlight></codeline>
<codeline lineno="1121"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>this<sp/>PCB<sp/>has<sp/>queued<sp/>out<sp/>of<sp/>sequence<sp/>data,<sp/>but<sp/>has<sp/>been</highlight></codeline>
<codeline lineno="1122"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>inactive<sp/>for<sp/>too<sp/>long,<sp/>will<sp/>drop<sp/>the<sp/>data<sp/>(it<sp/>will<sp/>eventually</highlight></codeline>
<codeline lineno="1123"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>be<sp/>retransmitted).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1124"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_QUEUE_OOSEQ</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1125"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;ooseq<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)tcp_ticks<sp/>-<sp/>pcb-&gt;tmr<sp/>&gt;=<sp/>pcb-&gt;rto<sp/>*<sp/>TCP_OOSEQ_TIMEOUT)<sp/>{</highlight></codeline>
<codeline lineno="1127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_segs_free(pcb-&gt;ooseq);</highlight></codeline>
<codeline lineno="1128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;ooseq<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a66df03d8192cd978d3321a9d68bf5411" kindref="member">TCP_CWND_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>dropping<sp/>OOSEQ<sp/>queued<sp/>data\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1130"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1131"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1132"><highlight class="normal"></highlight></codeline>
<codeline lineno="1133"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>this<sp/>PCB<sp/>has<sp/>stayed<sp/>too<sp/>long<sp/>in<sp/>SYN-RCVD<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1134"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>SYN_RCVD)<sp/>{</highlight></codeline>
<codeline lineno="1135"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;</highlight></codeline>
<codeline lineno="1136"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>TCP_SYN_RCVD_TIMEOUT<sp/>/<sp/>TCP_SLOW_INTERVAL)<sp/>{</highlight></codeline>
<codeline lineno="1137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++pcb_remove;</highlight></codeline>
<codeline lineno="1138"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>removing<sp/>pcb<sp/>stuck<sp/>in<sp/>SYN-RCVD\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1140"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1141"><highlight class="normal"></highlight></codeline>
<codeline lineno="1142"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>this<sp/>PCB<sp/>has<sp/>stayed<sp/>too<sp/>long<sp/>in<sp/>LAST-ACK<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1143"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>LAST_ACK)<sp/>{</highlight></codeline>
<codeline lineno="1144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;<sp/>2<sp/>*<sp/>TCP_MSL<sp/>/<sp/>TCP_SLOW_INTERVAL)<sp/>{</highlight></codeline>
<codeline lineno="1145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++pcb_remove;</highlight></codeline>
<codeline lineno="1146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>removing<sp/>pcb<sp/>stuck<sp/>in<sp/>LAST-ACK\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1147"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1148"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1149"><highlight class="normal"></highlight></codeline>
<codeline lineno="1150"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>the<sp/>PCB<sp/>should<sp/>be<sp/>removed,<sp/>do<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1151"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb_remove)<sp/>{</highlight></codeline>
<codeline lineno="1152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb2;</highlight></codeline>
<codeline lineno="1153"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1154"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_err_fn<sp/>err_fn<sp/>=<sp/>pcb-&gt;errf;</highlight></codeline>
<codeline lineno="1155"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1156"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*err_arg;</highlight></codeline>
<codeline lineno="1157"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>tcp_state<sp/>last_state;</highlight></codeline>
<codeline lineno="1158"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_pcb_purge(pcb);</highlight></codeline>
<codeline lineno="1159"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Remove<sp/>PCB<sp/>from<sp/>tcp_active_pcbs<sp/>list.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1160"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1161"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>middle<sp/>tcp<sp/>!=<sp/>tcp_active_pcbs&quot;</highlight><highlight class="normal">,<sp/>pcb<sp/>!=<sp/>tcp_active_pcbs);</highlight></codeline>
<codeline lineno="1162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prev-&gt;next<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>PCB<sp/>was<sp/>the<sp/>first.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>first<sp/>pcb<sp/>==<sp/>tcp_active_pcbs&quot;</highlight><highlight class="normal">,<sp/>tcp_active_pcbs<sp/>==<sp/>pcb);</highlight></codeline>
<codeline lineno="1166"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_active_pcbs<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1168"><highlight class="normal"></highlight></codeline>
<codeline lineno="1169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb_reset)<sp/>{</highlight></codeline>
<codeline lineno="1170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_rst(pcb-&gt;snd_nxt,<sp/>pcb-&gt;rcv_nxt,<sp/>&amp;pcb-&gt;local_ip,<sp/>&amp;pcb-&gt;remote_ip,</highlight></codeline>
<codeline lineno="1171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;local_port,<sp/>pcb-&gt;remote_port);</highlight></codeline>
<codeline lineno="1172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1173"><highlight class="normal"></highlight></codeline>
<codeline lineno="1174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>err_arg<sp/>=<sp/>pcb-&gt;callback_arg;</highlight></codeline>
<codeline lineno="1175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>last_state<sp/>=<sp/>pcb-&gt;state;</highlight></codeline>
<codeline lineno="1176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb2<sp/>=<sp/>pcb;</highlight></codeline>
<codeline lineno="1177"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1178"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB,<sp/>pcb2);</highlight></codeline>
<codeline lineno="1179"><highlight class="normal"></highlight></codeline>
<codeline lineno="1180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_active_pcbs_changed<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>TCP_EVENT_ERR(last_state,<sp/>err_fn,<sp/>err_arg,<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaf316b2c5eee4079820f7100849115142" kindref="member">ERR_ABRT</ref>);</highlight></codeline>
<codeline lineno="1182"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tcp_active_pcbs_changed)<sp/>{</highlight></codeline>
<codeline lineno="1183"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>tcp_slowtmr_start;</highlight></codeline>
<codeline lineno="1184"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1185"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>&apos;next&apos;<sp/>element<sp/>now<sp/>and<sp/>work<sp/>with<sp/>&apos;prev&apos;<sp/>below<sp/>(in<sp/>case<sp/>of<sp/>abort)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>prev<sp/>=<sp/>pcb;</highlight></codeline>
<codeline lineno="1188"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1189"><highlight class="normal"></highlight></codeline>
<codeline lineno="1190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>check<sp/>if<sp/>we<sp/>should<sp/>poll<sp/>the<sp/>connection.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>++prev-&gt;polltmr;</highlight></codeline>
<codeline lineno="1192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prev-&gt;polltmr<sp/>&gt;=<sp/>prev-&gt;pollinterval)<sp/>{</highlight></codeline>
<codeline lineno="1193"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prev-&gt;polltmr<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1194"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>polling<sp/>application\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_active_pcbs_changed<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>TCP_EVENT_POLL(prev,<sp/>err);</highlight></codeline>
<codeline lineno="1197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tcp_active_pcbs_changed)<sp/>{</highlight></codeline>
<codeline lineno="1198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>tcp_slowtmr_start;</highlight></codeline>
<codeline lineno="1199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>err<sp/>==<sp/>ERR_ABRT,<sp/>&apos;prev&apos;<sp/>is<sp/>already<sp/>deallocated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1202"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_output(prev);</highlight></codeline>
<codeline lineno="1203"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1204"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1205"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1206"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1207"><highlight class="normal"></highlight></codeline>
<codeline lineno="1208"><highlight class="normal"></highlight></codeline>
<codeline lineno="1209"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Steps<sp/>through<sp/>all<sp/>of<sp/>the<sp/>TIME-WAIT<sp/>PCBs.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1210"><highlight class="normal"><sp/><sp/>prev<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1211"><highlight class="normal"><sp/><sp/>pcb<sp/>=<sp/>tcp_tw_pcbs;</highlight></codeline>
<codeline lineno="1212"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1213"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>TIME-WAIT<sp/>pcb-&gt;state<sp/>==<sp/>TIME-WAIT&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>==<sp/>TIME_WAIT);</highlight></codeline>
<codeline lineno="1214"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb_remove<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1215"><highlight class="normal"></highlight></codeline>
<codeline lineno="1216"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>this<sp/>PCB<sp/>has<sp/>stayed<sp/>long<sp/>enough<sp/>in<sp/>TIME-WAIT<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1217"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;<sp/>2<sp/>*<sp/>TCP_MSL<sp/>/<sp/>TCP_SLOW_INTERVAL)<sp/>{</highlight></codeline>
<codeline lineno="1218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>++pcb_remove;</highlight></codeline>
<codeline lineno="1219"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1220"><highlight class="normal"></highlight></codeline>
<codeline lineno="1221"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>the<sp/>PCB<sp/>should<sp/>be<sp/>removed,<sp/>do<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1222"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb_remove)<sp/>{</highlight></codeline>
<codeline lineno="1223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb2;</highlight></codeline>
<codeline lineno="1224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_pcb_purge(pcb);</highlight></codeline>
<codeline lineno="1225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Remove<sp/>PCB<sp/>from<sp/>tcp_tw_pcbs<sp/>list.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1227"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>middle<sp/>tcp<sp/>!=<sp/>tcp_tw_pcbs&quot;</highlight><highlight class="normal">,<sp/>pcb<sp/>!=<sp/>tcp_tw_pcbs);</highlight></codeline>
<codeline lineno="1228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prev-&gt;next<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>PCB<sp/>was<sp/>the<sp/>first.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1231"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_slowtmr:<sp/>first<sp/>pcb<sp/>==<sp/>tcp_tw_pcbs&quot;</highlight><highlight class="normal">,<sp/>tcp_tw_pcbs<sp/>==<sp/>pcb);</highlight></codeline>
<codeline lineno="1232"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_tw_pcbs<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb2<sp/>=<sp/>pcb;</highlight></codeline>
<codeline lineno="1235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_PCB,<sp/>pcb2);</highlight></codeline>
<codeline lineno="1237"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>prev<sp/>=<sp/>pcb;</highlight></codeline>
<codeline lineno="1239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1240"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1241"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1242"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1243"><highlight class="normal"></highlight></codeline>
<codeline lineno="1250"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1251"><highlight class="normal">tcp_fasttmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1252"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1253"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb;</highlight></codeline>
<codeline lineno="1254"><highlight class="normal"></highlight></codeline>
<codeline lineno="1255"><highlight class="normal"><sp/><sp/>++tcp_timer_ctr;</highlight></codeline>
<codeline lineno="1256"><highlight class="normal"></highlight></codeline>
<codeline lineno="1257"><highlight class="normal">tcp_fasttmr_start:</highlight></codeline>
<codeline lineno="1258"><highlight class="normal"><sp/><sp/>pcb<sp/>=<sp/>tcp_active_pcbs;</highlight></codeline>
<codeline lineno="1259"><highlight class="normal"></highlight></codeline>
<codeline lineno="1260"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1261"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;last_timer<sp/>!=<sp/>tcp_timer_ctr)<sp/>{</highlight></codeline>
<codeline lineno="1262"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*next;</highlight></codeline>
<codeline lineno="1263"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;last_timer<sp/>=<sp/>tcp_timer_ctr;</highlight></codeline>
<codeline lineno="1264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>delayed<sp/>ACKs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1265"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;flags<sp/>&amp;<sp/>TF_ACK_DELAY)<sp/>{</highlight></codeline>
<codeline lineno="1266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_fasttmr:<sp/>delayed<sp/>ACK\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_ack_now(pcb);</highlight></codeline>
<codeline lineno="1268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_output(pcb);</highlight></codeline>
<codeline lineno="1269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>&amp;=<sp/>~(TF_ACK_DELAY<sp/>|<sp/>TF_ACK_NOW);</highlight></codeline>
<codeline lineno="1270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>pending<sp/>FIN<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;flags<sp/>&amp;<sp/>TF_CLOSEPEND)<sp/>{</highlight></codeline>
<codeline lineno="1273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_fasttmr:<sp/>pending<sp/>FIN\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1274"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>&amp;=<sp/>~(TF_CLOSEPEND);</highlight></codeline>
<codeline lineno="1275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_close_shutdown_fin(pcb);</highlight></codeline>
<codeline lineno="1276"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1277"><highlight class="normal"></highlight></codeline>
<codeline lineno="1278"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>next<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1279"><highlight class="normal"></highlight></codeline>
<codeline lineno="1280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>there<sp/>is<sp/>data<sp/>which<sp/>was<sp/>previously<sp/>&quot;refused&quot;<sp/>by<sp/>upper<sp/>layer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;refused_data<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1282"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_active_pcbs_changed<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_process_refused_data(pcb);</highlight></codeline>
<codeline lineno="1284"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tcp_active_pcbs_changed)<sp/>{</highlight></codeline>
<codeline lineno="1285"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>application<sp/>callback<sp/>has<sp/>changed<sp/>the<sp/>pcb<sp/>list:<sp/>restart<sp/>the<sp/>loop<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>tcp_fasttmr_start;</highlight></codeline>
<codeline lineno="1287"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1288"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1289"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>next;</highlight></codeline>
<codeline lineno="1290"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1292"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1293"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1294"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1295"><highlight class="normal"></highlight></codeline>
<codeline lineno="1297"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1298"><highlight class="normal">tcp_txnow(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1299"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1300"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb;</highlight></codeline>
<codeline lineno="1301"><highlight class="normal"></highlight></codeline>
<codeline lineno="1302"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_active_pcbs;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="1303"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;flags<sp/>&amp;<sp/>TF_NAGLEMEMERR)<sp/>{</highlight></codeline>
<codeline lineno="1304"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_output(pcb);</highlight></codeline>
<codeline lineno="1305"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1306"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1307"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1308"><highlight class="normal"></highlight></codeline>
<codeline lineno="1310"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1311"><highlight class="normal">tcp_process_refused_data(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="1312"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1313"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1314"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*rest;</highlight></codeline>
<codeline lineno="1315"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pcb-&gt;refused_data<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)</highlight></codeline>
<codeline lineno="1316"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1317"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="1318"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="1319"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>refused_flags<sp/>=<sp/>pcb-&gt;refused_data-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref>;</highlight></codeline>
<codeline lineno="1320"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>pcb-&gt;refused_data<sp/>to<sp/>NULL<sp/>in<sp/>case<sp/>the<sp/>callback<sp/>frees<sp/>it<sp/>and<sp/>then</highlight></codeline>
<codeline lineno="1321"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>closes<sp/>the<sp/>pcb<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1322"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*refused_data<sp/>=<sp/>pcb-&gt;refused_data;</highlight></codeline>
<codeline lineno="1323"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1324"><highlight class="normal"><sp/><sp/><sp/><sp/>pbuf_split_64k(refused_data,<sp/>&amp;rest);</highlight></codeline>
<codeline lineno="1325"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;refused_data<sp/>=<sp/>rest;</highlight></codeline>
<codeline lineno="1326"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1327"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;refused_data<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1328"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1329"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Notify<sp/>again<sp/>application<sp/>with<sp/>data<sp/>previously<sp/>received.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1330"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1af51dc2563536de56470146749f715ba8" kindref="member">TCP_INPUT_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_input:<sp/>notify<sp/>kept<sp/>packet\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1331"><highlight class="normal"><sp/><sp/><sp/><sp/>TCP_EVENT_RECV(pcb,<sp/>refused_data,<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>,<sp/>err);</highlight></codeline>
<codeline lineno="1332"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>did<sp/>refused_data<sp/>include<sp/>a<sp/>FIN?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(refused_flags<sp/>&amp;<sp/><ref refid="pbuf_8h_1a36a915aa2f6a188baa2862881407971e" kindref="member">PBUF_FLAG_TCP_FIN</ref></highlight></codeline>
<codeline lineno="1335"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1a89ffd0d7d1529bdb26bfbad267d0ad75" kindref="member">TCP_QUEUE_OOSEQ</ref><sp/>&amp;&amp;<sp/><ref refid="lwipopts_8h_1a88dbbfeeeb41b129fdc8235fc08bb530" kindref="member">LWIP_WND_SCALE</ref></highlight></codeline>
<codeline lineno="1336"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>&amp;&amp;<sp/>(rest<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)</highlight></codeline>
<codeline lineno="1337"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1338"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="1339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>correct<sp/>rcv_wnd<sp/>as<sp/>the<sp/>application<sp/>won&apos;t<sp/>call<sp/>tcp_recved()</highlight></codeline>
<codeline lineno="1340"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>for<sp/>the<sp/>FIN&apos;s<sp/>seqno<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;rcv_wnd<sp/>!=<sp/>TCP_WND_MAX(pcb))<sp/>{</highlight></codeline>
<codeline lineno="1342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;rcv_wnd++;</highlight></codeline>
<codeline lineno="1343"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>TCP_EVENT_CLOSED(pcb,<sp/>err);</highlight></codeline>
<codeline lineno="1345"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaf316b2c5eee4079820f7100849115142" kindref="member">ERR_ABRT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaf316b2c5eee4079820f7100849115142" kindref="member">ERR_ABRT</ref>;</highlight></codeline>
<codeline lineno="1347"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1348"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1349"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaf316b2c5eee4079820f7100849115142" kindref="member">ERR_ABRT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1350"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>err<sp/>==<sp/>ERR_ABRT,<sp/>&apos;pcb&apos;<sp/>is<sp/>already<sp/>deallocated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1351"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Drop<sp/>incoming<sp/>packets<sp/>because<sp/>pcb<sp/>is<sp/>&quot;full&quot;<sp/>(only<sp/>if<sp/>the<sp/>incoming</highlight></codeline>
<codeline lineno="1352"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>segment<sp/>contains<sp/>data).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1353"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1af51dc2563536de56470146749f715ba8" kindref="member">TCP_INPUT_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_input:<sp/>drop<sp/>incoming<sp/>packets,<sp/>because<sp/>pcb<sp/>is<sp/>\&quot;full\&quot;\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaf316b2c5eee4079820f7100849115142" kindref="member">ERR_ABRT</ref>;</highlight></codeline>
<codeline lineno="1355"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1356"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>data<sp/>is<sp/>still<sp/>refused,<sp/>pbuf<sp/>is<sp/>still<sp/>valid<sp/>(go<sp/>on<sp/>for<sp/>ACK-only<sp/>packets)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1357"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1358"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(rest<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" kindref="member">pbuf_cat</ref>(refused_data,<sp/>rest);</highlight></codeline>
<codeline lineno="1360"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1361"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;refused_data<sp/>=<sp/>refused_data;</highlight></codeline>
<codeline lineno="1363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca13e1dd0edca8a27b6abdf1524bde7929" kindref="member">ERR_INPROGRESS</ref>;</highlight></codeline>
<codeline lineno="1364"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1365"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1366"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1367"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1368"><highlight class="normal"></highlight></codeline>
<codeline lineno="1374"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1375"><highlight class="normal">tcp_segs_free(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_seg<sp/>*seg)</highlight></codeline>
<codeline lineno="1376"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1377"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(seg<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1378"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_seg<sp/>*next<sp/>=<sp/>seg-&gt;next;</highlight></codeline>
<codeline lineno="1379"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_seg_free(seg);</highlight></codeline>
<codeline lineno="1380"><highlight class="normal"><sp/><sp/><sp/><sp/>seg<sp/>=<sp/>next;</highlight></codeline>
<codeline lineno="1381"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1382"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1383"><highlight class="normal"></highlight></codeline>
<codeline lineno="1389"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1390"><highlight class="normal">tcp_seg_free(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_seg<sp/>*seg)</highlight></codeline>
<codeline lineno="1391"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1392"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(seg<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1393"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(seg-&gt;p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1394"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(seg-&gt;p);</highlight></codeline>
<codeline lineno="1395"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_DEBUG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1396"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>seg-&gt;p<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1397"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_DEBUG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1398"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1399"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_TCP_SEG,<sp/>seg);</highlight></codeline>
<codeline lineno="1400"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1401"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1402"><highlight class="normal"></highlight></codeline>
<codeline lineno="1409"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1410"><highlight class="normal">tcp_setprio(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>prio)</highlight></codeline>
<codeline lineno="1411"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1412"><highlight class="normal"><sp/><sp/>pcb-&gt;prio<sp/>=<sp/>prio;</highlight></codeline>
<codeline lineno="1413"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1414"><highlight class="normal"></highlight></codeline>
<codeline lineno="1415"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_QUEUE_OOSEQ</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1416"><highlight class="normal"></highlight></codeline>
<codeline lineno="1423"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_seg<sp/>*</highlight></codeline>
<codeline lineno="1424"><highlight class="normal">tcp_seg_copy(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_seg<sp/>*seg)</highlight></codeline>
<codeline lineno="1425"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1426"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_seg<sp/>*cseg;</highlight></codeline>
<codeline lineno="1427"><highlight class="normal"></highlight></codeline>
<codeline lineno="1428"><highlight class="normal"><sp/><sp/>cseg<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_seg<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_TCP_SEG);</highlight></codeline>
<codeline lineno="1429"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(cseg<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1430"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1431"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1432"><highlight class="normal"><sp/><sp/><ref refid="lwipopts_8h_1a8c6e3c1e4f74acb16376188dbf8909ec" kindref="member">SMEMCPY</ref>((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)cseg,<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)seg,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_seg));</highlight></codeline>
<codeline lineno="1433"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" kindref="member">pbuf_ref</ref>(cseg-&gt;p);</highlight></codeline>
<codeline lineno="1434"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>cseg;</highlight></codeline>
<codeline lineno="1435"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1436"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1437"><highlight class="normal"></highlight></codeline>
<codeline lineno="1438"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1439"><highlight class="normal"></highlight></codeline>
<codeline lineno="1443"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1444"><highlight class="normal">tcp_recv_null(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err)</highlight></codeline>
<codeline lineno="1445"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1446"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(arg);</highlight></codeline>
<codeline lineno="1447"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1448"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_recved(pcb,<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>);</highlight></codeline>
<codeline lineno="1449"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1450"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1451"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_close(pcb);</highlight></codeline>
<codeline lineno="1452"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1453"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1454"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1455"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1456"><highlight class="normal"></highlight></codeline>
<codeline lineno="1463"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1464"><highlight class="normal">tcp_kill_prio(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>prio)</highlight></codeline>
<codeline lineno="1465"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1466"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb,<sp/>*inactive;</highlight></codeline>
<codeline lineno="1467"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>inactivity;</highlight></codeline>
<codeline lineno="1468"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>mprio;</highlight></codeline>
<codeline lineno="1469"><highlight class="normal"></highlight></codeline>
<codeline lineno="1470"><highlight class="normal"><sp/><sp/>mprio<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(TCP_PRIO_MAX,<sp/>prio);</highlight></codeline>
<codeline lineno="1471"><highlight class="normal"></highlight></codeline>
<codeline lineno="1472"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>kill<sp/>the<sp/>oldest<sp/>active<sp/>connection<sp/>that<sp/>has<sp/>lower<sp/>priority<sp/>than<sp/>prio.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1473"><highlight class="normal"><sp/><sp/>inactivity<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1474"><highlight class="normal"><sp/><sp/>inactive<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1475"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_active_pcbs;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="1476"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;prio<sp/>&lt;=<sp/>mprio<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1477"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;=<sp/>inactivity)<sp/>{</highlight></codeline>
<codeline lineno="1478"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>inactivity<sp/>=<sp/>tcp_ticks<sp/>-<sp/>pcb-&gt;tmr;</highlight></codeline>
<codeline lineno="1479"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>inactive<sp/>=<sp/>pcb;</highlight></codeline>
<codeline lineno="1480"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>mprio<sp/>=<sp/>pcb-&gt;prio;</highlight></codeline>
<codeline lineno="1481"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1482"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1483"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(inactive<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1484"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_kill_prio:<sp/>killing<sp/>oldest<sp/>PCB<sp/>%p<sp/>(%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4b1eca99bc81e248c7074ea87fc9ca63" kindref="member">S32_F</ref></highlight><highlight class="stringliteral">&quot;)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1485"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)inactive,<sp/>inactivity));</highlight></codeline>
<codeline lineno="1486"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_abort(inactive);</highlight></codeline>
<codeline lineno="1487"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1488"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1489"><highlight class="normal"></highlight></codeline>
<codeline lineno="1494"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1495"><highlight class="normal">tcp_kill_state(</highlight><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>tcp_state<sp/>state)</highlight></codeline>
<codeline lineno="1496"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1497"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb,<sp/>*inactive;</highlight></codeline>
<codeline lineno="1498"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>inactivity;</highlight></codeline>
<codeline lineno="1499"><highlight class="normal"></highlight></codeline>
<codeline lineno="1500"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>state&quot;</highlight><highlight class="normal">,<sp/>(state<sp/>==<sp/>CLOSING)<sp/>||<sp/>(state<sp/>==<sp/>LAST_ACK));</highlight></codeline>
<codeline lineno="1501"><highlight class="normal"></highlight></codeline>
<codeline lineno="1502"><highlight class="normal"><sp/><sp/>inactivity<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1503"><highlight class="normal"><sp/><sp/>inactive<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1504"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Go<sp/>through<sp/>the<sp/>list<sp/>of<sp/>active<sp/>pcbs<sp/>and<sp/>get<sp/>the<sp/>oldest<sp/>pcb<sp/>that<sp/>is<sp/>in<sp/>state</highlight></codeline>
<codeline lineno="1505"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>CLOSING/LAST_ACK.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1506"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_active_pcbs;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="1507"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>==<sp/>state)<sp/>{</highlight></codeline>
<codeline lineno="1508"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;=<sp/>inactivity)<sp/>{</highlight></codeline>
<codeline lineno="1509"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>inactivity<sp/>=<sp/>tcp_ticks<sp/>-<sp/>pcb-&gt;tmr;</highlight></codeline>
<codeline lineno="1510"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>inactive<sp/>=<sp/>pcb;</highlight></codeline>
<codeline lineno="1511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1512"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1513"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1514"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(inactive<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1515"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_kill_closing:<sp/>killing<sp/>oldest<sp/>%s<sp/>PCB<sp/>%p<sp/>(%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4b1eca99bc81e248c7074ea87fc9ca63" kindref="member">S32_F</ref></highlight><highlight class="stringliteral">&quot;)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1516"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_state_str[state],<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)inactive,<sp/>inactivity));</highlight></codeline>
<codeline lineno="1517"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>send<sp/>a<sp/>RST,<sp/>since<sp/>no<sp/>data<sp/>is<sp/>lost.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1518"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_abandon(inactive,<sp/>0);</highlight></codeline>
<codeline lineno="1519"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1520"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1521"><highlight class="normal"></highlight></codeline>
<codeline lineno="1526"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1527"><highlight class="normal">tcp_kill_timewait(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1528"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1529"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb,<sp/>*inactive;</highlight></codeline>
<codeline lineno="1530"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>inactivity;</highlight></codeline>
<codeline lineno="1531"><highlight class="normal"></highlight></codeline>
<codeline lineno="1532"><highlight class="normal"><sp/><sp/>inactivity<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1533"><highlight class="normal"><sp/><sp/>inactive<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1534"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Go<sp/>through<sp/>the<sp/>list<sp/>of<sp/>TIME_WAIT<sp/>pcbs<sp/>and<sp/>get<sp/>the<sp/>oldest<sp/>pcb.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1535"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_tw_pcbs;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="1536"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)(tcp_ticks<sp/>-<sp/>pcb-&gt;tmr)<sp/>&gt;=<sp/>inactivity)<sp/>{</highlight></codeline>
<codeline lineno="1537"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>inactivity<sp/>=<sp/>tcp_ticks<sp/>-<sp/>pcb-&gt;tmr;</highlight></codeline>
<codeline lineno="1538"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>inactive<sp/>=<sp/>pcb;</highlight></codeline>
<codeline lineno="1539"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1540"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1541"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(inactive<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1542"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_kill_timewait:<sp/>killing<sp/>oldest<sp/>TIME-WAIT<sp/>PCB<sp/>%p<sp/>(%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4b1eca99bc81e248c7074ea87fc9ca63" kindref="member">S32_F</ref></highlight><highlight class="stringliteral">&quot;)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1543"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)inactive,<sp/>inactivity));</highlight></codeline>
<codeline lineno="1544"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_abort(inactive);</highlight></codeline>
<codeline lineno="1545"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1546"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1547"><highlight class="normal"></highlight></codeline>
<codeline lineno="1554"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*</highlight></codeline>
<codeline lineno="1555"><highlight class="normal">tcp_alloc(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>prio)</highlight></codeline>
<codeline lineno="1556"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1557"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb;</highlight></codeline>
<codeline lineno="1558"><highlight class="normal"></highlight></codeline>
<codeline lineno="1559"><highlight class="normal"><sp/><sp/>pcb<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1560"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1561"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>killing<sp/>oldest<sp/>connection<sp/>in<sp/>TIME-WAIT.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1562"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_alloc:<sp/>killing<sp/>off<sp/>oldest<sp/>TIME-WAIT<sp/>connection\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1563"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_kill_timewait();</highlight></codeline>
<codeline lineno="1564"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>to<sp/>allocate<sp/>a<sp/>tcp_pcb<sp/>again.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1565"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1566"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1567"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>killing<sp/>oldest<sp/>connection<sp/>in<sp/>LAST-ACK<sp/>(these<sp/>wouldn&apos;t<sp/>go<sp/>to<sp/>TIME-WAIT).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1568"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_alloc:<sp/>killing<sp/>off<sp/>oldest<sp/>LAST-ACK<sp/>connection\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1569"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_kill_state(LAST_ACK);</highlight></codeline>
<codeline lineno="1570"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>to<sp/>allocate<sp/>a<sp/>tcp_pcb<sp/>again.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1571"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1572"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1573"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>killing<sp/>oldest<sp/>connection<sp/>in<sp/>CLOSING.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1574"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_alloc:<sp/>killing<sp/>off<sp/>oldest<sp/>CLOSING<sp/>connection\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1575"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_kill_state(CLOSING);</highlight></codeline>
<codeline lineno="1576"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>to<sp/>allocate<sp/>a<sp/>tcp_pcb<sp/>again.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1577"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1578"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1579"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>killing<sp/>active<sp/>connections<sp/>with<sp/>lower<sp/>priority<sp/>than<sp/>the<sp/>new<sp/>one.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1580"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_alloc:<sp/>killing<sp/>connection<sp/>with<sp/>prio<sp/>lower<sp/>than<sp/>%d\n&quot;</highlight><highlight class="normal">,<sp/>prio));</highlight></codeline>
<codeline lineno="1581"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tcp_kill_prio(prio);</highlight></codeline>
<codeline lineno="1582"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>to<sp/>allocate<sp/>a<sp/>tcp_pcb<sp/>again.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1583"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1584"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1585"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>adjust<sp/>err<sp/>stats:<sp/>memp_malloc<sp/>failed<sp/>multiple<sp/>times<sp/>before<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1586"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1acdadac8ecdb9710b2cbd0a0dc4a9d4c1" kindref="member">MEMP_STATS_DEC</ref>(err,<sp/>MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1587"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1588"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1589"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1590"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>adjust<sp/>err<sp/>stats:<sp/>memp_malloc<sp/>failed<sp/>multiple<sp/>times<sp/>before<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1591"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1acdadac8ecdb9710b2cbd0a0dc4a9d4c1" kindref="member">MEMP_STATS_DEC</ref>(err,<sp/>MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1592"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1593"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1594"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1595"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>adjust<sp/>err<sp/>stats:<sp/>memp_malloc<sp/>failed<sp/>multiple<sp/>times<sp/>before<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1acdadac8ecdb9710b2cbd0a0dc4a9d4c1" kindref="member">MEMP_STATS_DEC</ref>(err,<sp/>MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1597"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1598"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1599"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1600"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>adjust<sp/>err<sp/>stats:<sp/>memp_malloc<sp/>failed<sp/>above<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1601"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1acdadac8ecdb9710b2cbd0a0dc4a9d4c1" kindref="member">MEMP_STATS_DEC</ref>(err,<sp/>MEMP_TCP_PCB);</highlight></codeline>
<codeline lineno="1602"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1603"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1604"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1605"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>zero<sp/>out<sp/>the<sp/>whole<sp/>pcb,<sp/>so<sp/>there<sp/>is<sp/>no<sp/>need<sp/>to<sp/>initialize<sp/>members<sp/>to<sp/>zero<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1606"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(pcb,<sp/>0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb));</highlight></codeline>
<codeline lineno="1607"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;prio<sp/>=<sp/>prio;</highlight></codeline>
<codeline lineno="1608"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;snd_buf<sp/>=<sp/><ref refid="lwipopts_8h_1a871d111968d8c6c7880ff36b93c5c4dd" kindref="member">TCP_SND_BUF</ref>;</highlight></codeline>
<codeline lineno="1609"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Start<sp/>with<sp/>a<sp/>window<sp/>that<sp/>does<sp/>not<sp/>need<sp/>scaling.<sp/>When<sp/>window<sp/>scaling<sp/>is</highlight></codeline>
<codeline lineno="1610"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>enabled<sp/>and<sp/>used,<sp/>the<sp/>window<sp/>is<sp/>enlarged<sp/>when<sp/>both<sp/>sides<sp/>agree<sp/>on<sp/>scaling.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1611"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;rcv_wnd<sp/>=<sp/>pcb-&gt;rcv_ann_wnd<sp/>=<sp/>TCPWND_MIN16(<ref refid="lwipopts_8h_1a7f535a6efb5cdf86c3210e35ece1d6a7" kindref="member">TCP_WND</ref>);</highlight></codeline>
<codeline lineno="1612"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;ttl<sp/>=<sp/><ref refid="lwipopts_8h_1acd5b25ea81d2894790d25da5393cdab4" kindref="member">TCP_TTL</ref>;</highlight></codeline>
<codeline lineno="1613"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>As<sp/>initial<sp/>send<sp/>MSS,<sp/>we<sp/>use<sp/>TCP_MSS<sp/>but<sp/>limit<sp/>it<sp/>to<sp/>536.</highlight></codeline>
<codeline lineno="1614"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>The<sp/>send<sp/>MSS<sp/>is<sp/>updated<sp/>when<sp/>an<sp/>MSS<sp/>option<sp/>is<sp/>received.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1615"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;mss<sp/>=<sp/>INITIAL_MSS;</highlight></codeline>
<codeline lineno="1616"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;rto<sp/>=<sp/>3000<sp/>/<sp/>TCP_SLOW_INTERVAL;</highlight></codeline>
<codeline lineno="1617"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;sv<sp/>=<sp/>3000<sp/>/<sp/>TCP_SLOW_INTERVAL;</highlight></codeline>
<codeline lineno="1618"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;rtime<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1619"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;cwnd<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1620"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;tmr<sp/>=<sp/>tcp_ticks;</highlight></codeline>
<codeline lineno="1621"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;last_timer<sp/>=<sp/>tcp_timer_ctr;</highlight></codeline>
<codeline lineno="1622"><highlight class="normal"></highlight></codeline>
<codeline lineno="1623"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>RFC<sp/>5681<sp/>recommends<sp/>setting<sp/>ssthresh<sp/>abritrarily<sp/>high<sp/>and<sp/>gives<sp/>an<sp/>example</highlight></codeline>
<codeline lineno="1624"><highlight class="comment"><sp/><sp/><sp/><sp/>of<sp/>using<sp/>the<sp/>largest<sp/>advertised<sp/>receive<sp/>window.<sp/><sp/>We&apos;ve<sp/>seen<sp/>complications<sp/>with</highlight></codeline>
<codeline lineno="1625"><highlight class="comment"><sp/><sp/><sp/><sp/>receiving<sp/>TCPs<sp/>that<sp/>use<sp/>window<sp/>scaling<sp/>and/or<sp/>window<sp/>auto-tuning<sp/>where<sp/>the</highlight></codeline>
<codeline lineno="1626"><highlight class="comment"><sp/><sp/><sp/><sp/>initial<sp/>advertised<sp/>window<sp/>is<sp/>very<sp/>small<sp/>and<sp/>then<sp/>grows<sp/>rapidly<sp/>once<sp/>the</highlight></codeline>
<codeline lineno="1627"><highlight class="comment"><sp/><sp/><sp/><sp/>connection<sp/>is<sp/>established.<sp/>To<sp/>avoid<sp/>these<sp/>complications,<sp/>we<sp/>set<sp/>ssthresh<sp/>to<sp/>the</highlight></codeline>
<codeline lineno="1628"><highlight class="comment"><sp/><sp/><sp/><sp/>largest<sp/>effective<sp/>cwnd<sp/>(amount<sp/>of<sp/>in-flight<sp/>data)<sp/>that<sp/>the<sp/>sender<sp/>can<sp/>have.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1629"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;ssthresh<sp/>=<sp/><ref refid="lwipopts_8h_1a871d111968d8c6c7880ff36b93c5c4dd" kindref="member">TCP_SND_BUF</ref>;</highlight></codeline>
<codeline lineno="1630"><highlight class="normal"></highlight></codeline>
<codeline lineno="1631"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1632"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;recv<sp/>=<sp/>tcp_recv_null;</highlight></codeline>
<codeline lineno="1633"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1634"><highlight class="normal"></highlight></codeline>
<codeline lineno="1635"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Init<sp/>KEEPALIVE<sp/>timer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1636"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;keep_idle<sp/><sp/>=<sp/>TCP_KEEPIDLE_DEFAULT;</highlight></codeline>
<codeline lineno="1637"><highlight class="normal"></highlight></codeline>
<codeline lineno="1638"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP_KEEPALIVE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1639"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;keep_intvl<sp/>=<sp/>TCP_KEEPINTVL_DEFAULT;</highlight></codeline>
<codeline lineno="1640"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;keep_cnt<sp/><sp/><sp/>=<sp/>TCP_KEEPCNT_DEFAULT;</highlight></codeline>
<codeline lineno="1641"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP_KEEPALIVE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1642"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1643"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pcb;</highlight></codeline>
<codeline lineno="1644"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1645"><highlight class="normal"></highlight></codeline>
<codeline lineno="1659"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*</highlight></codeline>
<codeline lineno="1660"><highlight class="normal">tcp_new(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1661"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1662"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_alloc(TCP_PRIO_NORMAL);</highlight></codeline>
<codeline lineno="1663"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1664"><highlight class="normal"></highlight></codeline>
<codeline lineno="1676"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*</highlight></codeline>
<codeline lineno="1677"><highlight class="normal">tcp_new_ip_type(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>type)</highlight></codeline>
<codeline lineno="1678"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1679"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*<sp/>pcb;</highlight></codeline>
<codeline lineno="1680"><highlight class="normal"><sp/><sp/>pcb<sp/>=<sp/>tcp_alloc(TCP_PRIO_NORMAL);</highlight></codeline>
<codeline lineno="1681"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1682"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1683"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1aaa800ce1929a1bb0f3d64bebd44e4051" kindref="member">IP_SET_TYPE_VAL</ref>(pcb-&gt;local_ip,<sp/>type);</highlight></codeline>
<codeline lineno="1684"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1aaa800ce1929a1bb0f3d64bebd44e4051" kindref="member">IP_SET_TYPE_VAL</ref>(pcb-&gt;remote_ip,<sp/>type);</highlight></codeline>
<codeline lineno="1685"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1686"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1687"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(type);</highlight></codeline>
<codeline lineno="1688"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1689"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pcb;</highlight></codeline>
<codeline lineno="1690"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1691"><highlight class="normal"></highlight></codeline>
<codeline lineno="1700"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1701"><highlight class="normal">tcp_arg(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg)</highlight></codeline>
<codeline lineno="1702"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1703"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>function<sp/>is<sp/>allowed<sp/>to<sp/>be<sp/>called<sp/>for<sp/>both<sp/>listen<sp/>pcbs<sp/>and</highlight></codeline>
<codeline lineno="1704"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>connection<sp/>pcbs.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1705"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1706"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;callback_arg<sp/>=<sp/>arg;</highlight></codeline>
<codeline lineno="1707"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1708"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1709"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1710"><highlight class="normal"></highlight></codeline>
<codeline lineno="1719"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1720"><highlight class="normal">tcp_recv(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/>tcp_recv_fn<sp/>recv)</highlight></codeline>
<codeline lineno="1721"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1722"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1723"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>socket<sp/>state<sp/>for<sp/>recv<sp/>callback&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN);</highlight></codeline>
<codeline lineno="1724"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;recv<sp/>=<sp/>recv;</highlight></codeline>
<codeline lineno="1725"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1726"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1727"><highlight class="normal"></highlight></codeline>
<codeline lineno="1736"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1737"><highlight class="normal">tcp_sent(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/>tcp_sent_fn<sp/>sent)</highlight></codeline>
<codeline lineno="1738"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1739"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1740"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>socket<sp/>state<sp/>for<sp/>sent<sp/>callback&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN);</highlight></codeline>
<codeline lineno="1741"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;sent<sp/>=<sp/>sent;</highlight></codeline>
<codeline lineno="1742"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1743"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1744"><highlight class="normal"></highlight></codeline>
<codeline lineno="1756"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1757"><highlight class="normal">tcp_err(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/>tcp_err_fn<sp/>err)</highlight></codeline>
<codeline lineno="1758"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1759"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1760"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>socket<sp/>state<sp/>for<sp/>err<sp/>callback&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN);</highlight></codeline>
<codeline lineno="1761"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;errf<sp/>=<sp/>err;</highlight></codeline>
<codeline lineno="1762"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1763"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1764"><highlight class="normal"></highlight></codeline>
<codeline lineno="1774"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1775"><highlight class="normal">tcp_accept(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/>tcp_accept_fn<sp/>accept)</highlight></codeline>
<codeline lineno="1776"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1777"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(pcb-&gt;state<sp/>==<sp/>LISTEN))<sp/>{</highlight></codeline>
<codeline lineno="1778"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb_listen<sp/>*lpcb<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb_listen*)pcb;</highlight></codeline>
<codeline lineno="1779"><highlight class="normal"><sp/><sp/><sp/><sp/>lpcb-&gt;accept<sp/>=<sp/>accept;</highlight></codeline>
<codeline lineno="1780"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1781"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1782"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1783"><highlight class="normal"></highlight></codeline>
<codeline lineno="1784"><highlight class="normal"></highlight></codeline>
<codeline lineno="1792"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1793"><highlight class="normal">tcp_poll(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb,<sp/>tcp_poll_fn<sp/>poll,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>interval)</highlight></codeline>
<codeline lineno="1794"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1795"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>socket<sp/>state<sp/>for<sp/>poll&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN);</highlight></codeline>
<codeline lineno="1796"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CALLBACK_API</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1797"><highlight class="normal"><sp/><sp/>pcb-&gt;poll<sp/>=<sp/>poll;</highlight></codeline>
<codeline lineno="1798"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1799"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(poll);</highlight></codeline>
<codeline lineno="1800"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CALLBACK_API<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1801"><highlight class="normal"><sp/><sp/>pcb-&gt;pollinterval<sp/>=<sp/>interval;</highlight></codeline>
<codeline lineno="1802"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1803"><highlight class="normal"></highlight></codeline>
<codeline lineno="1810"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1811"><highlight class="normal">tcp_pcb_purge(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="1812"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1813"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>!=<sp/>CLOSED<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1814"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>!=<sp/>TIME_WAIT<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1815"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN)<sp/>{</highlight></codeline>
<codeline lineno="1816"><highlight class="normal"></highlight></codeline>
<codeline lineno="1817"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_pcb_purge\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1818"><highlight class="normal"></highlight></codeline>
<codeline lineno="1819"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_backlog_accepted(pcb);</highlight></codeline>
<codeline lineno="1820"><highlight class="normal"></highlight></codeline>
<codeline lineno="1821"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;refused_data<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1822"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_pcb_purge:<sp/>data<sp/>left<sp/>on<sp/>-&gt;refused_data\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1823"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(pcb-&gt;refused_data);</highlight></codeline>
<codeline lineno="1824"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;refused_data<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1825"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1826"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;unsent<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1827"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_pcb_purge:<sp/>not<sp/>all<sp/>data<sp/>sent\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1828"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1829"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;unacked<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1830"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_pcb_purge:<sp/>data<sp/>left<sp/>on<sp/>-&gt;unacked\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1831"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1832"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_QUEUE_OOSEQ</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1833"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;ooseq<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1834"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;tcp_pcb_purge:<sp/>data<sp/>left<sp/>on<sp/>-&gt;ooseq\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1835"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1836"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_segs_free(pcb-&gt;ooseq);</highlight></codeline>
<codeline lineno="1837"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;ooseq<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1838"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1839"><highlight class="normal"></highlight></codeline>
<codeline lineno="1840"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Stop<sp/>the<sp/>retransmission<sp/>timer<sp/>as<sp/>it<sp/>will<sp/>expect<sp/>data<sp/>on<sp/>unacked</highlight></codeline>
<codeline lineno="1841"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>queue<sp/>if<sp/>it<sp/>fires<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1842"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;rtime<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1843"><highlight class="normal"></highlight></codeline>
<codeline lineno="1844"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_segs_free(pcb-&gt;unsent);</highlight></codeline>
<codeline lineno="1845"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_segs_free(pcb-&gt;unacked);</highlight></codeline>
<codeline lineno="1846"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;unacked<sp/>=<sp/>pcb-&gt;unsent<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1847"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_OVERSIZE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1848"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;unsent_oversize<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1849"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_OVERSIZE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1850"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1851"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1852"><highlight class="normal"></highlight></codeline>
<codeline lineno="1859"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1860"><highlight class="normal">tcp_pcb_remove(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>**pcblist,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="1861"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1862"><highlight class="normal"><sp/><sp/>TCP_RMV(pcblist,<sp/>pcb);</highlight></codeline>
<codeline lineno="1863"><highlight class="normal"></highlight></codeline>
<codeline lineno="1864"><highlight class="normal"><sp/><sp/>tcp_pcb_purge(pcb);</highlight></codeline>
<codeline lineno="1865"><highlight class="normal"></highlight></codeline>
<codeline lineno="1866"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>there<sp/>is<sp/>an<sp/>outstanding<sp/>delayed<sp/>ACKs,<sp/>send<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1867"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>!=<sp/>TIME_WAIT<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1868"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1869"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>&amp;<sp/>TF_ACK_DELAY)<sp/>{</highlight></codeline>
<codeline lineno="1870"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb-&gt;flags<sp/>|=<sp/>TF_ACK_NOW;</highlight></codeline>
<codeline lineno="1871"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_output(pcb);</highlight></codeline>
<codeline lineno="1872"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1873"><highlight class="normal"></highlight></codeline>
<codeline lineno="1874"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcb-&gt;state<sp/>!=<sp/>LISTEN)<sp/>{</highlight></codeline>
<codeline lineno="1875"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;unsent<sp/>segments<sp/>leaking&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;unsent<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1876"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;unacked<sp/>segments<sp/>leaking&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;unacked<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1877"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_QUEUE_OOSEQ</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1878"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;ooseq<sp/>segments<sp/>leaking&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;ooseq<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1879"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_QUEUE_OOSEQ<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1880"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1881"><highlight class="normal"></highlight></codeline>
<codeline lineno="1882"><highlight class="normal"><sp/><sp/>pcb-&gt;state<sp/>=<sp/>CLOSED;</highlight></codeline>
<codeline lineno="1883"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>reset<sp/>the<sp/>local<sp/>port<sp/>to<sp/>prevent<sp/>the<sp/>pcb<sp/>from<sp/>being<sp/>&apos;bound&apos;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1884"><highlight class="normal"><sp/><sp/>pcb-&gt;local_port<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1885"><highlight class="normal"></highlight></codeline>
<codeline lineno="1886"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_pcb_remove:<sp/>tcp_pcbs_sane()&quot;</highlight><highlight class="normal">,<sp/>tcp_pcbs_sane());</highlight></codeline>
<codeline lineno="1887"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1888"><highlight class="normal"></highlight></codeline>
<codeline lineno="1894"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref></highlight></codeline>
<codeline lineno="1895"><highlight class="normal">tcp_next_iss(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb<sp/>*pcb)</highlight></codeline>
<codeline lineno="1896"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1897"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_TCP_ISN</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1898"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>LWIP_HOOK_TCP_ISN(&amp;pcb-&gt;local_ip,<sp/>pcb-&gt;local_port,<sp/>&amp;pcb-&gt;remote_ip,<sp/>pcb-&gt;remote_port);</highlight></codeline>
<codeline lineno="1899"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_HOOK_TCP_ISN<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1900"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>iss<sp/>=<sp/>6510;</highlight></codeline>
<codeline lineno="1901"><highlight class="normal"></highlight></codeline>
<codeline lineno="1902"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(pcb);</highlight></codeline>
<codeline lineno="1903"><highlight class="normal"></highlight></codeline>
<codeline lineno="1904"><highlight class="normal"><sp/><sp/>iss<sp/>+=<sp/>tcp_ticks;<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>XXX<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1905"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>iss;</highlight></codeline>
<codeline lineno="1906"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_HOOK_TCP_ISN<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1907"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1908"><highlight class="normal"></highlight></codeline>
<codeline lineno="1909"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_CALCULATE_EFF_SEND_MSS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1910"><highlight class="normal"></highlight></codeline>
<codeline lineno="1915"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="1916"><highlight class="normal">tcp_eff_send_mss_impl(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>sendmss,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*dest</highlight></codeline>
<codeline lineno="1917"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1a872e3bb3fe2212156d66b18fccc9643f" kindref="member">LWIP_IPV6</ref><sp/>||<sp/>LWIP_IPV4_SRC_ROUTING</highlight></codeline>
<codeline lineno="1918"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*src</highlight></codeline>
<codeline lineno="1919"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>||<sp/>LWIP_IPV4_SRC_ROUTING<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1920"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>)</highlight></codeline>
<codeline lineno="1921"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1922"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>mss_s;</highlight></codeline>
<codeline lineno="1923"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*outif;</highlight></codeline>
<codeline lineno="1924"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref><sp/><ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref>;</highlight></codeline>
<codeline lineno="1925"><highlight class="normal"></highlight></codeline>
<codeline lineno="1926"><highlight class="normal"><sp/><sp/>outif<sp/>=<sp/>ip_route(src,<sp/>dest);</highlight></codeline>
<codeline lineno="1927"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1928"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1929"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1a9bac7e938757f1d24df2404e8b57cb7d" kindref="member">IP_IS_V6</ref>(dest))</highlight></codeline>
<codeline lineno="1930"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1931"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="1932"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>First<sp/>look<sp/>in<sp/>destination<sp/>cache,<sp/>to<sp/>see<sp/>if<sp/>there<sp/>is<sp/>a<sp/>Path<sp/>MTU.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1933"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>=<sp/>nd6_get_destination_mtu(<ref refid="ip__addr_8h_1a06e75bcd198012b5ba39480c233608bd" kindref="member">ip_2_ip6</ref>(dest),<sp/>outif);</highlight></codeline>
<codeline lineno="1934"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1935"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1936"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1937"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1938"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1939"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1940"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="1941"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(outif<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1942"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>sendmss;</highlight></codeline>
<codeline lineno="1943"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1944"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>=<sp/>outif-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref>;</highlight></codeline>
<codeline lineno="1945"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1946"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1947"><highlight class="normal"></highlight></codeline>
<codeline lineno="1948"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1949"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1950"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1951"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1a9bac7e938757f1d24df2404e8b57cb7d" kindref="member">IP_IS_V6</ref>(dest))</highlight></codeline>
<codeline lineno="1952"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1953"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="1954"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>mss_s<sp/>=<sp/><ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>-<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref><sp/>-<sp/><ref refid="prot_2tcp_8h_1a5758db371d6daa394d178429b7c94c2a" kindref="member">TCP_HLEN</ref>;</highlight></codeline>
<codeline lineno="1955"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1956"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1957"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1958"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1959"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1960"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1961"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="1962"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>mss_s<sp/>=<sp/><ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>-<sp/><ref refid="prot_2ip4_8h_1ad76777d4d34f33ab5f715f9ca15503c3" kindref="member">IP_HLEN</ref><sp/>-<sp/><ref refid="prot_2tcp_8h_1a5758db371d6daa394d178429b7c94c2a" kindref="member">TCP_HLEN</ref>;</highlight></codeline>
<codeline lineno="1963"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1964"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1965"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>RFC<sp/>1122,<sp/>chap<sp/>4.2.2.6:</highlight></codeline>
<codeline lineno="1966"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>Eff.snd.MSS<sp/>=<sp/>min(SendMSS+20,<sp/>MMS_S)<sp/>-<sp/>TCPhdrsize<sp/>-<sp/>IPoptionsize</highlight></codeline>
<codeline lineno="1967"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>We<sp/>correct<sp/>for<sp/>TCP<sp/>options<sp/>in<sp/>tcp_write(),<sp/>and<sp/>don&apos;t<sp/>support<sp/>IP<sp/>options.</highlight></codeline>
<codeline lineno="1968"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1969"><highlight class="normal"><sp/><sp/><sp/><sp/>sendmss<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(sendmss,<sp/>mss_s);</highlight></codeline>
<codeline lineno="1970"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1971"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>sendmss;</highlight></codeline>
<codeline lineno="1972"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1973"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_CALCULATE_EFF_SEND_MSS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1974"><highlight class="normal"></highlight></codeline>
<codeline lineno="1976"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1977"><highlight class="normal">tcp_netif_ip_addr_changed_pcblist(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref>*<sp/>old_addr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>tcp_pcb*<sp/>pcb_list)</highlight></codeline>
<codeline lineno="1978"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1979"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb;</highlight></codeline>
<codeline lineno="1980"><highlight class="normal"><sp/><sp/>pcb<sp/>=<sp/>pcb_list;</highlight></codeline>
<codeline lineno="1981"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1982"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>PCB<sp/>bound<sp/>to<sp/>current<sp/>local<sp/>interface<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1983"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&amp;pcb-&gt;local_ip,<sp/>old_addr)</highlight></codeline>
<codeline lineno="1984"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1aaf1b3a089827223589baf1b7f4f57069" kindref="member">LWIP_AUTOIP</ref></highlight></codeline>
<codeline lineno="1985"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>connections<sp/>to<sp/>link-local<sp/>addresses<sp/>must<sp/>persist<sp/>(RFC3927<sp/>ch.<sp/>1.9)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1986"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>&amp;&amp;<sp/>(!<ref refid="ip__addr_8h_1ab1a059f07bd9c50aa58447d963b823a1" kindref="member">IP_IS_V4_VAL</ref>(pcb-&gt;local_ip)<sp/>||<sp/>!ip4_addr_islinklocal(ip_2_ip4(&amp;pcb-&gt;local_ip)))</highlight></codeline>
<codeline lineno="1987"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_AUTOIP<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1988"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="1989"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>connection<sp/>must<sp/>be<sp/>aborted<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1990"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*next<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1991"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a2dfad02b075a7f9a8791a66fe40864a4" kindref="member">NETIF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;netif_set_ipaddr:<sp/>aborting<sp/>TCP<sp/>pcb<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)pcb));</highlight></codeline>
<codeline lineno="1992"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_abort(pcb);</highlight></codeline>
<codeline lineno="1993"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>next;</highlight></codeline>
<codeline lineno="1994"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1995"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb<sp/>=<sp/>pcb-&gt;next;</highlight></codeline>
<codeline lineno="1996"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1997"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1998"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1999"><highlight class="normal"></highlight></codeline>
<codeline lineno="2005"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2006"><highlight class="normal">tcp_netif_ip_addr_changed(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref>*<sp/>old_addr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref>*<sp/>new_addr)</highlight></codeline>
<codeline lineno="2007"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2008"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb_listen<sp/>*lpcb,<sp/>*next;</highlight></codeline>
<codeline lineno="2009"><highlight class="normal"></highlight></codeline>
<codeline lineno="2010"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(old_addr))<sp/>{</highlight></codeline>
<codeline lineno="2011"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_netif_ip_addr_changed_pcblist(old_addr,<sp/>tcp_active_pcbs);</highlight></codeline>
<codeline lineno="2012"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_netif_ip_addr_changed_pcblist(old_addr,<sp/>tcp_bound_pcbs);</highlight></codeline>
<codeline lineno="2013"><highlight class="normal"></highlight></codeline>
<codeline lineno="2014"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(new_addr))<sp/>{</highlight></codeline>
<codeline lineno="2015"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>PCB<sp/>bound<sp/>to<sp/>current<sp/>local<sp/>interface<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2016"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(lpcb<sp/>=<sp/>tcp_listen_pcbs.listen_pcbs;<sp/>lpcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>lpcb<sp/>=<sp/>next)<sp/>{</highlight></codeline>
<codeline lineno="2017"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>next<sp/>=<sp/>lpcb-&gt;next;</highlight></codeline>
<codeline lineno="2018"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>PCB<sp/>bound<sp/>to<sp/>current<sp/>local<sp/>interface<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2019"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&amp;lpcb-&gt;local_ip,<sp/>old_addr))<sp/>{</highlight></codeline>
<codeline lineno="2020"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>The<sp/>PCB<sp/>is<sp/>listening<sp/>to<sp/>the<sp/>old<sp/>ipaddr<sp/>and</highlight></codeline>
<codeline lineno="2021"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>is<sp/>set<sp/>to<sp/>listen<sp/>to<sp/>the<sp/>new<sp/>one<sp/>instead<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2022"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a77a933975db287f6aa5c2e70249ba18f" kindref="member">ip_addr_copy</ref>(lpcb-&gt;local_ip,<sp/>*new_addr);</highlight></codeline>
<codeline lineno="2023"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="2024"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="2025"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="2026"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2027"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2028"><highlight class="normal"></highlight></codeline>
<codeline lineno="2029"><highlight class="normal"></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*</highlight></codeline>
<codeline lineno="2030"><highlight class="normal">tcp_debug_state_str(</highlight><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>tcp_state<sp/>s)</highlight></codeline>
<codeline lineno="2031"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2032"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>tcp_state_str[s];</highlight></codeline>
<codeline lineno="2033"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2034"><highlight class="normal"></highlight></codeline>
<codeline lineno="2035"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_DEBUG<sp/>||<sp/>TCP_INPUT_DEBUG<sp/>||<sp/>TCP_OUTPUT_DEBUG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2036"><highlight class="normal"></highlight></codeline>
<codeline lineno="2041"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2042"><highlight class="normal">tcp_debug_print(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structtcp__hdr" kindref="compound">tcp_hdr</ref><sp/>*tcphdr)</highlight></codeline>
<codeline lineno="2043"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2044"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;TCP<sp/>header:\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2045"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2046"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/><sp/><sp/><sp/>%5&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/><sp/>|<sp/><sp/><sp/><sp/>%5&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/><sp/>|<sp/>(src<sp/>port,<sp/>dest<sp/>port)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="2047"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(tcphdr-&gt;src),<sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(tcphdr-&gt;dest)));</highlight></codeline>
<codeline lineno="2048"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2049"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>%010&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>|<sp/>(seq<sp/>no)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="2050"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(tcphdr-&gt;seqno)));</highlight></codeline>
<codeline lineno="2051"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2052"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>%010&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>|<sp/>(ack<sp/>no)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="2053"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(tcphdr-&gt;ackno)));</highlight></codeline>
<codeline lineno="2054"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2055"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/>%2&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>|<sp/><sp/><sp/>|%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;|<sp/><sp/><sp/><sp/><sp/>%5&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/>|<sp/>(hdrlen,<sp/>flags<sp/>(&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="2056"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="prot_2tcp_8h_1a5b97d3b7e68c20eb3eab87a61d779223" kindref="member">TCPH_HDRLEN</ref>(tcphdr),</highlight></codeline>
<codeline lineno="2057"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="prot_2tcp_8h_1ad5de3cf876b2c7f6835f44132fe0e9d5" kindref="member">TCPH_FLAGS</ref>(tcphdr)<sp/>&gt;&gt;<sp/>5<sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="2058"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="prot_2tcp_8h_1ad5de3cf876b2c7f6835f44132fe0e9d5" kindref="member">TCPH_FLAGS</ref>(tcphdr)<sp/>&gt;&gt;<sp/>4<sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="2059"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="prot_2tcp_8h_1ad5de3cf876b2c7f6835f44132fe0e9d5" kindref="member">TCPH_FLAGS</ref>(tcphdr)<sp/>&gt;&gt;<sp/>3<sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="2060"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="prot_2tcp_8h_1ad5de3cf876b2c7f6835f44132fe0e9d5" kindref="member">TCPH_FLAGS</ref>(tcphdr)<sp/>&gt;&gt;<sp/>2<sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="2061"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="prot_2tcp_8h_1ad5de3cf876b2c7f6835f44132fe0e9d5" kindref="member">TCPH_FLAGS</ref>(tcphdr)<sp/>&gt;&gt;<sp/>1<sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="2062"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="prot_2tcp_8h_1ad5de3cf876b2c7f6835f44132fe0e9d5" kindref="member">TCPH_FLAGS</ref>(tcphdr)<sp/><sp/><sp/><sp/><sp/><sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="2063"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(tcphdr-&gt;wnd)));</highlight></codeline>
<codeline lineno="2064"><highlight class="normal"><sp/><sp/>tcp_debug_print_flags(<ref refid="prot_2tcp_8h_1ad5de3cf876b2c7f6835f44132fe0e9d5" kindref="member">TCPH_FLAGS</ref>(tcphdr));</highlight></codeline>
<codeline lineno="2065"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;),<sp/>win)\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2066"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2067"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/><sp/><sp/><sp/>0x%04&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/>|<sp/><sp/><sp/><sp/><sp/>%5&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/>|<sp/>(chksum,<sp/>urgp)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="2068"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(tcphdr-&gt;chksum),<sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(tcphdr-&gt;urgp)));</highlight></codeline>
<codeline lineno="2069"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2070"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2071"><highlight class="normal"></highlight></codeline>
<codeline lineno="2077"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2078"><highlight class="normal">tcp_debug_print_state(</highlight><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>tcp_state<sp/>s)</highlight></codeline>
<codeline lineno="2079"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2080"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;State:<sp/>%s\n&quot;</highlight><highlight class="normal">,<sp/>tcp_state_str[s]));</highlight></codeline>
<codeline lineno="2081"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2082"><highlight class="normal"></highlight></codeline>
<codeline lineno="2088"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2089"><highlight class="normal">tcp_debug_print_flags(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>flags)</highlight></codeline>
<codeline lineno="2090"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2091"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/><ref refid="prot_2tcp_8h_1a88e60aa2cf23e1c65d630701db08c743" kindref="member">TCP_FIN</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2092"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;FIN<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2093"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2094"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/><ref refid="prot_2tcp_8h_1a6020613f5062417d9811cfa837215c83" kindref="member">TCP_SYN</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2095"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;SYN<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2096"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2097"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/><ref refid="prot_2tcp_8h_1a5ca559def464ef20d8b1f7d32f2f160d" kindref="member">TCP_RST</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2098"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;RST<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2099"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2100"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/><ref refid="prot_2tcp_8h_1a1320fd0006a2f70138bc2d0018dda829" kindref="member">TCP_PSH</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2101"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;PSH<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2102"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2103"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/><ref refid="prot_2tcp_8h_1a44b3b1ab31a403ba28ec135adfcbefef" kindref="member">TCP_ACK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2104"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ACK<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2105"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2106"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/><ref refid="prot_2tcp_8h_1ac84f499cba8a02fc0e306c10b2acabf0" kindref="member">TCP_URG</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2107"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;URG<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2108"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2109"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/><ref refid="prot_2tcp_8h_1ae6ba06711820fc4365ad0d78f70171dd" kindref="member">TCP_ECE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2110"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ECE<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2111"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2112"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/><ref refid="prot_2tcp_8h_1a6f441228e74f83c026c48360667beb48" kindref="member">TCP_CWR</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2113"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;CWR<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2114"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2115"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2116"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2117"><highlight class="normal"></highlight></codeline>
<codeline lineno="2121"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2122"><highlight class="normal">tcp_debug_print_pcbs(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="2123"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2124"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb;</highlight></codeline>
<codeline lineno="2125"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb_listen<sp/>*pcbl;</highlight></codeline>
<codeline lineno="2126"><highlight class="normal"></highlight></codeline>
<codeline lineno="2127"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;Active<sp/>PCB<sp/>states:\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2128"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_active_pcbs;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="2129"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;Local<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;,<sp/>foreign<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>snd_nxt<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>rcv_nxt<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="2130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;local_port,<sp/>pcb-&gt;remote_port,</highlight></codeline>
<codeline lineno="2131"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;snd_nxt,<sp/>pcb-&gt;rcv_nxt));</highlight></codeline>
<codeline lineno="2132"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_debug_print_state(pcb-&gt;state);</highlight></codeline>
<codeline lineno="2133"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2134"><highlight class="normal"></highlight></codeline>
<codeline lineno="2135"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;Listen<sp/>PCB<sp/>states:\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2136"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcbl<sp/>=<sp/>tcp_listen_pcbs.listen_pcbs;<sp/>pcbl<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcbl<sp/>=<sp/>pcbl-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="2137"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;Local<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>&quot;</highlight><highlight class="normal">,<sp/>pcbl-&gt;local_port));</highlight></codeline>
<codeline lineno="2138"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_debug_print_state(pcbl-&gt;state);</highlight></codeline>
<codeline lineno="2139"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2140"><highlight class="normal"></highlight></codeline>
<codeline lineno="2141"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;TIME-WAIT<sp/>PCB<sp/>states:\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="2142"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_tw_pcbs;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="2143"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a4f43bb8a430c7a52a1ad5086d3f2803c" kindref="member">TCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;Local<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;,<sp/>foreign<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>snd_nxt<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>rcv_nxt<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="2144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;local_port,<sp/>pcb-&gt;remote_port,</highlight></codeline>
<codeline lineno="2145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;snd_nxt,<sp/>pcb-&gt;rcv_nxt));</highlight></codeline>
<codeline lineno="2146"><highlight class="normal"><sp/><sp/><sp/><sp/>tcp_debug_print_state(pcb-&gt;state);</highlight></codeline>
<codeline lineno="2147"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2148"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2149"><highlight class="normal"></highlight></codeline>
<codeline lineno="2153"><highlight class="normal"><ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref></highlight></codeline>
<codeline lineno="2154"><highlight class="normal">tcp_pcbs_sane(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="2155"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2156"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb<sp/>*pcb;</highlight></codeline>
<codeline lineno="2157"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_active_pcbs;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="2158"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_pcbs_sane:<sp/>active<sp/>pcb-&gt;state<sp/>!=<sp/>CLOSED&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>CLOSED);</highlight></codeline>
<codeline lineno="2159"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_pcbs_sane:<sp/>active<sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>LISTEN);</highlight></codeline>
<codeline lineno="2160"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_pcbs_sane:<sp/>active<sp/>pcb-&gt;state<sp/>!=<sp/>TIME-WAIT&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>!=<sp/>TIME_WAIT);</highlight></codeline>
<codeline lineno="2161"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2162"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_tw_pcbs;<sp/>pcb<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="2163"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tcp_pcbs_sane:<sp/>tw<sp/>pcb-&gt;state<sp/>==<sp/>TIME-WAIT&quot;</highlight><highlight class="normal">,<sp/>pcb-&gt;state<sp/>==<sp/>TIME_WAIT);</highlight></codeline>
<codeline lineno="2164"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2165"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="2166"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2167"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_DEBUG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2168"><highlight class="normal"></highlight></codeline>
<codeline lineno="2169"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/tcp.c"/>
  </compounddef>
</doxygen>
