[Asterisk-code-review] res pjsip outbound registration.c: Fix handle client state d... (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Thu Jun 25 14:40:32 CDT 2015


Hello Mark Michelson,

I'd like you to reexamine a change.  Please visit

    https://gerrit.asterisk.org/707

to look at the new patch set (#2).

Change subject: res_pjsip_outbound_registration.c: Fix handle_client_state_destruction() refs
......................................................................

res_pjsip_outbound_registration.c: Fix handle_client_state_destruction() refs

* handle_client_state_destruction() must always be passed a ref to
client_state because it will always unref client_state.
handle_registration_response() was not passing a client_state ref.

* Made the final un-REGISTER message get sent normally using the pjproject
register control structure in handle_client_state_destruction().  The
previous code attempted to short circuit the response handling for the
module to unload.  That doesn't work for a couple reasons.  One,
pjsip_regc_send() may call the registered callback before it returns and
unbalance the client_state ref count.  Two, the registered callback
handles any authentication for the un-REGISTER message.

* Made the distinction between internal registration state and external
registration status with sip_outbound_registration_status_str().  This is
necessary to avoid altering documented AMI messages with internal
changes.

* Removed references to client_state->client outside of the serializer
thread.  When handle_client_state_destruction() destroys the pjproject
register control structure that memory is freed and cannot be referenced
anymore.  These accesses were to provide information for debug and
off-nominal warning messages.

* In sip_outbound_registration_timer_cb() you should not access entry->id
after unrefing client_state because the passed in entry is normally
pointing to the timer entry in the client_state object.

ASTERISK-24907
Reported by: Kevin Harwell

Change-Id: Ia7b446d8644b6b4550ef5bea49527671de65183f
---
M res/res_pjsip_outbound_registration.c
1 file changed, 95 insertions(+), 51 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/07/707/2
-- 
To view, visit https://gerrit.asterisk.org/707
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia7b446d8644b6b4550ef5bea49527671de65183f
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list