fix(iot-dev): Fix connection status reporting CONNECTED before all SDK states are CONNECTED#1355
Merged
timtay-microsoft merged 2 commits intomasterfrom Sep 10, 2021
Merged
Conversation
…K states are CONNECTED We were executing user facing callbacks with CONNECTED before we were executing SDK facing callbacks with the same state. As a result, users would try to do something like send telemetry as soon as CONNECTED state callback executes only to see an error saying that the deviceIO layer wasn't CONNECTED yet, too. The solution is to make sure all SDK facing state callbacks are executed before user facing callbacks are executed
| this.multiplexingStateCallback.execute(newConnectionStatus, reason, throwable, this.multiplexingStateCallbackContext); | ||
| } | ||
|
|
||
| this.deviceIOConnectionStatusChangeCallback.execute(newConnectionStatus, reason, throwable, null); |
Member
Author
There was a problem hiding this comment.
The user facing state callbacks were above this SDK facing state callback previously. Now this SDK facing state callback executes first
| // That will then execute the onConnectionEstablished callback on this same listener. Because of that, | ||
| // there is no listener callback to execute here for non-multiplexing cases. | ||
| this.listener.onMultiplexedDeviceSessionEstablished(this.connectionId, deviceId); | ||
| } |
Member
Author
There was a problem hiding this comment.
I found this bug while investigating this issue. We shouldn't have been calling "onMultiplexedDeviceSessionEstablished" when not multiplexing. It resulted in the SDK making multiple internal connection state updates when only one should have happened.
Member
Author
There was a problem hiding this comment.
This bug shouldn't have any meaningful impact on a user, but it did make debugging the connection state reporting confusing
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 4 pipeline(s). |
abhipsaMisra
approved these changes
Sep 10, 2021
This was referenced Sep 15, 2021
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.
We were executing user facing callbacks with CONNECTED before we were executing SDK facing callbacks with the same state. As a result, users would try to do something like send telemetry as soon as CONNECTED state callback executes only to see an error saying that the deviceIO layer wasn't CONNECTED yet, too.
The solution is to make sure all SDK facing state callbacks are executed before user facing state callbacks are executed
#1348