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

Cherry-pick #17549 to 7.x: [Heartbeat] Refactor TCP Monitor #17849

Merged
merged 1 commit into from
Apr 21, 2020

Commits on Apr 20, 2020

  1. [Heartbeat] Refactor TCP Monitor (elastic#17549)

    Refactors the TCP monitor to make the code easier to follow, more testable, and fixes elastic#17123 where TLS server name was not correctly sent. This is important because the code had accrued a lot of cruft and become very hard to follow. There were many wrappers and intermediate variable names that often subtly changed names as they crossed various functions. When debugging elastic#17123 I frequently found myself lost tracing the execution.
    
    This new code should be simpler to understand for a few reasons:
    
        Less code (almost a 2x reduction) and fewer, simpler, better organized functions
        Less variable passing/renaming due to use of struct for key config variables
        More consistent and descriptive variable names
        Creation of the dialer as late as possible, to remove the confusing partial states, and clarity as to when which dialer layers are used.
        Adds (frustratingly tricky) integration tests for elastic#17123 using mismatched TLS certs, and also against a real SOCKS5 proxy
        Adds, for testing only, the ability to override the real network resolver for TCP checks which is invaluable in debugging TLS checks that depend on setting hostnames correctly. In the future if we decide to let users use a custom DNS resolver this will be nice.
        Reorganized giant TCP test file into multiple files
    
    (cherry picked from commit dfe8c4b)
    andrewvc committed Apr 20, 2020
    Configuration menu
    Copy the full SHA
    2c2d4eb View commit details
    Browse the repository at this point in the history