• Jared Hancock's avatar
    extmod/modlwip: Use Nagle algorithm and add support for TCP_NODELAY. · b1e96027
    Jared Hancock authored
    This adds support to use the Nagle algorithm implemented already in lwIP to
    determine when TCP data should be sent.
    
    As currently written, MicroPython will only create packets if there is <25%
    remaining in the send buffer.  Using it, sending a small message of ~50
    bytes will not trigger output of the message on the network.  So it will
    remained queued until the TCP interval timer expires, which can be up to
    500ms.
    
    Using Nagle's algorithm, the first write, no matter how small, will
    generate a packet on the network.  And sending lots of data still makes
    efficient use of the link.
    
    In addition to this, an application designer may choose to always create
    packets for every write by setting the TCP_NODELAY socket option.  That's
    also implemented in this commit.
    b1e96027
modlwip.c 63.5 KB