Skip to content
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 crash during pickup if network is turned off #14

Merged
merged 3 commits into from
Nov 21, 2023

Conversation

codespree
Copy link
Contributor

In the current implementation, if the network is turned off, pickup of messages causes an application crash.

This PR fixes this by silently ignoring crashes during a pickup (as pickup will be retried at the polling frequency specified).

Also, there was no exception handling during the establishment of a connection (in the WalletMainActivity), this has been fixed too.

@conanoc / @DrumRobot request you to review this and merge.

Signed-off-by: Varun Chatterji <[email protected]>
Signed-off-by: Varun Chatterji <[email protected]>
Copy link
Contributor

@conanoc conanoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I want to remove the comments I marked.

try {
agent.messageSender.send(message)
} catch (e: Exception) {
// We catch the exception here because if there is a network failure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems too verbose.

} else if (agent.agentConfig.mediatorPickupStrategy == MediatorPickupStrategy.Implicit) {
// For implicit pickup, responseRequested must be set to false.
// Since no response is requested, the mediator can respond with queued messages.
// Otherwise, it would respond with a trust ping response.
val message = OutboundMessage(TrustPingMessage("pickup", false), mediatorConnection)
agent.messageSender.send(message, "ws")
try {
// We catch the exception here because if there is a network failure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@codespree
Copy link
Contributor Author

@conanoc I am ok with the changes but I cannot approve them in the review as I am the author. Would you like me to commit again with the comments removed?

Signed-off-by: Varun Chatterji <[email protected]>
@codespree
Copy link
Contributor Author

@conanoc removed the comments and committed again.

@DrumRobot
Copy link
Contributor

Looks good to me.

@conanoc conanoc merged commit 701f5ef into hyperledger:main Nov 21, 2023
3 checks passed
@conanoc
Copy link
Contributor

conanoc commented Nov 21, 2023

Merged. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants