Repository navigation
Complete the unregister before shutting the transport down - #20
Merged
calebtt merged 1 commit intoSep 26, 2026
Merged
Conversation
SipClient.Shutdown() called SIPRegistrationUserAgent.Stop(), which queues the unregister (REGISTER with Expires 0) on a thread-pool thread, and then shut the transport down straight away. The unregister is usually challenged, so it rarely completed: the registrar kept a dead contact until it expired and forked calls to it. Shutdown now sends the unregister and waits up to 3 s for the registrar to confirm it (RegistrationRemoved, or a failure) before shutting the transport down. When the client is not registered it stops the agent and sends nothing. RegistrationRemoved no longer leads to a reconnect once shutdown has begun (ScheduleReconnection checks _isShutdown). Closes #16 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
calebtt
force-pushed
the
fix/issue-16-shutdown-unregister
branch
from
September 26, 2026 01:17
6952270 to
0c36b26
Compare
calebtt
added this pull request to stack #21
September 26, 2026 01:23
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.
Summary
Closes #16. Stacked on #13's branch; merge after it. It uses #13's
FakeRegistrarand its_isShutdowncheck inScheduleReconnection.SipClient.Shutdown()calledSIPRegistrationUserAgent.Stop(), which queues the unregister (REGISTER with Expires 0) on a thread-pool thread, and then shut the transport down straight away. The unregister is usually challenged (401, then an authenticated retry), so it rarely completed. The registrar kept a dead contact until it expired and forked calls to it. Withsipbot serveandquit, a lab extension ended up listing three contacts.Changes
Shutdown()now sends the unregister and waits up to 3 s (SipClient.UnregisterTimeout) for the registrar to confirm it (RegistrationRemoved, or a failure) before it shuts the transport down._isShutdowncheck inScheduleReconnection; the test below covers it.Tests
New
ShutdownUnregisterTests, against #13's scripted loopback registrar:RegistrationRemoved).Without the fix, the first three fail: the unregister never goes out.
dotnet test: 90 passed (86 on #13 + 4 new). Build warnings unchanged (17).Compatibility
Dispose()andShutdown()can now take up to 3 s longer when the registrar does not answer the unregister. When it answers, the delay is a round trip or two. SipBotOpen, homeline, andsipbot(quit) now leave no stale contact behind.🤖 Generated with Claude Code