-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED] Conn and Subscription Close()/Unubscribe() could not be retried
If a connection is closed, or a subscription is closed or unsubscribed, and an error occurs at the protocol level, for instance getting a timeout or the NATS connection is currently disconnected, etc.. the Close()/Unsubscribe() calls would return an error but the user would not be able to invoke them again, in the sense that these calls would bail out early because those objects were already marked as closed. This was problematic because if an application closes a connection for instance but gets a timeout, then there is no way for the application to really try to tell the server that the connection should be closed. (same for subscription). This PR let the user call Close()/Unsubscribe() if the library failed to get a response from the server (likely timeout or NATS communication issue). However, if the server returns an error, then the connection/ subscription will be considered fully closed and user won't be able to call the close API again. The alternative would be to set the object as fully closed only in case of total success... Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
- Loading branch information
Showing
3 changed files
with
184 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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