Connection reliability and TLS correctness fixes, with a new unit test suite. - #75
Open
adamshapiro0 wants to merge 17 commits into
Open
Connection reliability and TLS correctness fixes, with a new unit test suite.#75adamshapiro0 wants to merge 17 commits into
adamshapiro0 wants to merge 17 commits into
Conversation
The delay previously only reset on a user-requested disconnect, so a session with recurring drops stayed pinned at the maximum. Waiting on a condition variable instead of polling also lets Disconnect() interrupt the delay immediately rather than up to 100 ms later.
The macro documented itself as enabled by default but fell back to 0, so compiling the library without the build system's flags silently produced a plaintext-only client. The build files now state the disabled case explicitly rather than relying on the default.
Clearing the flag meant a caller that asked for TLS and did not check the return value silently got an unencrypted connection, which for the authentication request means sending the API key in the clear.
A disconnect requested before the address loop returned a socket error while one requested during the connect returned POLARIS_CONNECTION_CLOSED, so the code a caller saw depended on timing.
The port is not range checked before being formatted, so a six byte buffer tripped -Wformat-truncation at -O2.
The corrections service publishes no AAAA records, so requesting IPv6 offered support the network cannot provide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New Features
POLARIS_NO_NETWORKso callers can tell a device with no connectivity from an endpoint that rejected themconnection_retryexampleChanges
POLARIS_ENABLE_TLSto enabled when it is undefinedgetaddrinfo()and try every address returned rather than only the firstDisconnect()without waiting for an in-progress connection attempt to finishFixes
POLARIS_NO_PRINTconsistently across the libraryPOLARIS_CONNECT_TIMEOUT_MSinstead of blocking on an unresponsive endpointEPIPEinstead of killing the application with exit code 141POLARIS_CONNECTION_CLOSEDwhether the disconnect arrives before or during the connectint, fixing a-Wformat-truncationfailure at-O2