-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fixed connection hang, segfault, and unexpected warnings issues after internet connection loss. #60
Conversation
This counter is intended to detect possible authentication issues (e.g., incorrect key). Socket errors, typically some form of "internet connection not available," should not count against that.
…ng cases. The Polaris network now sends an RTCM 1029 text message in response to an authentication failure or similar error. The client no longer receives 0 bytes when an authentication token is rejected. This change avoids misleading warnings when authentication is valid but position is not supplied, etc. We now return POLARIS_CONNECTION_CLOSED when the connection is closed without an authentication error, including if we do not receive any data from the network, and only return POLARIS_FORBIDDEN if we suspect an authentication issue.
The P1_SetAddress() does not currently support IPv6. This may change in the future.
Otherwise, ASAN needs to be manually loaded via LD_PRELOAD.
… out." We cannot remove these. Internally, polaris.c accesses them if POLARIS_USE_TLS is enabled _when polaris.c is compiled_. But if the user application does not set POLARIS_USE_TLS when they compile and instantiate PolarisContext_s, the context they create will be smaller than polaris.c is expecting and will cause a buffer overflow.
Without these, loss of internet connection could get treated as an unexpected socket error, rather than a timeout, and Polaris_Run() might exit its while loop and never reconnect.
3a7cd21
to
d56e7ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor stuff but looks good
else if (context->total_bytes_received > 0) { | ||
P1_Print( | ||
"Warning: Polaris connection closed with an error response. Is " | ||
"your authentication token valid?\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we print the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not without adding an RTCM parser. If we hit an errno it will be printed above before we get here, but if we get an error notification from the server it comes as an RTCM 1029 message. We could add functionality to parse it and verify the CRC, but we don't have that in this library currently.
f8c7a63
to
c5b7f1c
Compare
c5b7f1c
to
d1ac61b
Compare
Changes
Fixes
polaris_client.cc
gethostname()
(IPv6 not currently supported)Polaris_Send*()
position send function segfault if SSL context is not connected