2.x: Fix refCount() not resetting when cross-canceled #6629
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.
This PR fixes the issue with
refCount
not resetting the connection when the termination triggers cross-cancellation over it.Fixes #6608
The fix is more involved than #6609 because how 2.x uses two
publish()
implementation internally due to bugfix #6505. The old/classic implementation does not fail #6608 but the newer implementation fails #6608. If the fix is applied unconditionally, the old/classic implementation fails an older unit test verifying an error allows reconnection. Therefore, the PR checks and applies the new code path only ifrefCount
isn't talking to the classic publish implementation.As a reminder #6609 for 3.x has a redesigned
Connectable
with a much more clearer reset semantics and thus the restructuring of the termination handling had no trouble passing the aforementioned error-allows-reconnect unit test.