Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2P: improve RX/TX flow control #2017

Closed
wants to merge 2 commits into from
Closed

Commits on Nov 15, 2012

  1. P2P, cosmetic: break out buffer send(2) code into separate function

    Jeff Garzik authored and Jeff Garzik committed Nov 15, 2012
    Copy the full SHA
    fca5b98 View commit details
    Browse the repository at this point in the history
  2. P2P: improve RX/TX flow control

    1) "optimistic write": Push each message to kernel socket buffer immediately.
    
    2) If there is write data at select time, that implies send() blocked
       during optimistic write.  Drain write queue, before receiving
       any more messages.
    
    This avoids needlessly queueing received data, if the remote peer
    is not themselves receiving data.
    
    Result: write buffer (and thus memory usage) is kept small, DoS
    potential is slightly lower, and TCP flow control signalling is
    properly utilized.
    
    The kernel will queue data into the socket buffer, then signal the
    remote peer to stop sending data, until we resume reading again.
    Jeff Garzik authored and Jeff Garzik committed Nov 15, 2012
    Copy the full SHA
    4e4e6d1 View commit details
    Browse the repository at this point in the history