Repository navigation
refactor(pjsua): commit the new Contact in update_regc_contact() - #26
Open
laconicman wants to merge 2 commits into
Open
laconicman wants to merge 2 commits into
laconicman wants to merge 2 commits into
Conversation
Pass the candidate Contact into update_regc_contact() and commit it to acc->contact only after the regc has accepted it, so the rollback lives in one place instead of in acc_check_nat_addr() and auto_rereg_timer_cb(). This also drops acc_check_nat_addr()'s prev_contact, which in UNREGISTER mode was captured after destroy_regc() had already cleared acc->contact. Remove the else branch that aliased reg_contact to contact: len always exceeds acc->contact.slen, so it never ran. No behaviour change.
- Say that only a push can be refused, and that without push the Contact is committed before the regc has seen it. - Log "Contact for acc %d updated" only once the push has succeeded. - Treat &acc->contact as new_contact like NULL: pj_strdup_with_null() cannot copy a string onto itself. - Drop the OUTBOUND_WANTED store that the removed else left dead, and the bare block around its body. - Rename prev_contact to prev_reg_contact. - Note why auto_rereg_timer_cb() carries on after a refusal.
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.
Follow-up to pjsip#5281, as agreed in its review.
update_regc_contact()takes the candidate Contact and commits it toacc->contactonly after the regc accepts it, so the rollback is in one place;acc_check_nat_addr()andauto_rereg_timer_cb()no longer save and restoreacc->contact(review).acc_check_nat_addr()no longer capturesprev_contactafterdestroy_regc()has cleared it in UNREGISTER mode (review).elsethat aliasedreg_contacttocontactis removed (lenalways exceedsacc->contact.slen), together with theOUTBOUND_WANTEDstore it left dead. Its body is dedented, so the diff reads best with whitespace hidden.No behaviour change intended.
Verified on macOS arm64 (Apple clang 21), each build against the previous one (unpatched master, then the first review round):
make -j3pjsip-test pjsua_acc_testuas-register-outbound-norequire(tests/pjsua)Require: outbound, ACTIVE -> NA, 439 failover, initial 439, NAT rewrite, NAT rewrite after 401Not run here: Linux and Windows builds, and the full test suites.