-
Notifications
You must be signed in to change notification settings - Fork 137
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
Fixing a bug when stopping a disconnected connection #283
Conversation
Can you provide logs for the original issue? |
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 you add a test?
Here is a sample code to reproduce the Problem:
here is the log:
|
Thanks for providing the repro and the logs! |
@moozzyk I updated the code and added the Unit Test for this case |
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.
Thanks for the PR! LGTM!
Problem Description
I faced an issue when the connection gets a stop request when it is in the
disconnected
state.This could happen when switching the tab very quickly or getting the app in background and opening it quickly.
The connection will then not be able to restart.
Steps to reproduce
Start a connection
Stop the connection
Then call
stop()
againTry to start the connection again : the connection could not be started, we get :
Expected behaviour
The connection should be able to start again
Debugging informations
When calling
stop()
(ReconnectableConnection
class) for the second time, it will change the state directly tostopping
(without checking the current state).Then it will call
underlyingConnection.stop(stopError: stopError)
In the stop function (
HttpConnection
class), it will check if the connection is in thestopped
state and will print a log message without continuing the rest of the function , that is why we do not get any callback after that and the connection will remain in thestopping
state forever.Suggested solution
Checking the current state of the connection before executing the stop process
Related issues
This Pull Request might could be related to #204 and #86