log and guard the sender unlock in BaseSender.stop - #2198
Open
RomanHerbstmann wants to merge 1 commit into
Open
RomanHerbstmann wants to merge 1 commit into
RomanHerbstmann wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Log and guard the sender unlock in
BaseSender.stopSmall follow-up to #2195 / #2197.
Problem
Since the unlock moved into
BaseSender.stop(clear, unlockNeeded):RtmpClient/RtspClientloggedsender blocked in socket writeat that point. Without it, logcat no longer shows whether a slow disconnect or reconnect was caused by a blocked write, which makes field issues hard to diagnose.unlockNeeded()propagates out ofstop()anddisconnect(). The current callers passsocket?.close(), which does not throw in practice, butunlockNeededis a public parameter and a throwing lambda would escape into the reconnect scope.Fix
Log.wwith the sender'sTAGright before callingunlockNeeded().unlockNeeded()is wrapped intry/catch:CancellationExceptionis rethrown so structured cancellation keeps working, and any other exception is logged instead of escaping.runCatchingis intentionally not used, because it would also swallowCancellationException.Test
BaseSenderTest:unlockNeededreleases it:unlockNeededis invoked andstop()returns. This adds coverage for the unlock path, which had no test yet.unlockNeededthrows: the exception does not propagate out ofstop(). This test fails without this change../gradlew :common:testDebugUnitTest: all tests pass.iptables -A INPUT -p tcp --sport 1935 -j DROP). This PR only adds logging and exception handling around it.