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

improve port handling #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Mar 18, 2022

  1. improve port handling

    This commit tries to improve two issues
    
    1) A free port is obtained by setting the port value as zero and the
    OS will bind to a free port. We immediately close the port and then
    later create another socket on the same port. The issue with the
    approach is, OS could allocate the same port to another because we
    have closed the port. This leads to a situation where more than one
    bypass server could listen on the same port (this is possible because
    of SO_REUSEPORT flag). The issue is fixed by not closing the socket.
    
    2) Bypass exposes a down api, which closes the socket. The issue here
    is the same as above, the OS is free to allocate the port to
    others. The current solution tries to fix the issue by keeping track
    of which test owns which ports and try not to reuse the same
    ports. This is still not foolproof, there is a small interval during
    which the socket is active, but better than the old logic.
    ananthakumaran committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    d0ba183 View commit details
    Browse the repository at this point in the history