Move legacy mode modifications to single points #1704
Merged
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.
Fixes #1703
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Core Tests
This race condition is difficult to reproduce. The main tests should be that the legacy mode continues to work. Also have the library close the connection to ensure that still works at closing the connection properly.
Summary
There was a possible race condition where two sections of code could modify the legacy transport and set it to null. This could cause NPEs to occur even after null checks. The code was refactored a little to simple call into the synchronous method that exits out of legacy mode. This means the only time the legacy transport is created or set to null will be in the synchronized enter and exit legacy mode methods.
Changelog
Bug Fixes
CLA