-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix freeze on reconnection attempts #54
Conversation
@@ -21,6 +21,7 @@ import java.net.ConnectException | |||
import java.net.SocketException | |||
import java.util.concurrent.CompletableFuture | |||
import java.util.concurrent.ConcurrentLinkedQueue | |||
import java.util.concurrent.atomic.AtomicBoolean |
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.
Why is a simple boolean
not sufficient?
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.
Because we are doing the check in an other thread (CompletableFuture
) which means we need an AtomicBoolean to avoid race conditions with the disconnect method that might be call from a different thread
What does this PR do ?
This PR aims to fix a bug that occurs when trying to reconnect and that freezes the SDK during the reconnection
tryToReconnect
now returns aCompletableFuture<Boolean>
instead of aBoolean
Other