[Asterisk-code-review] res pjsip contact: Lock expiration/addition of contacts (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Thu Apr 7 15:54:42 CDT 2016


Richard Mudgett has posted comments on this change.

Change subject: res_pjsip contact:  Lock expiration/addition of contacts
......................................................................


Patch Set 1: Code-Review-1

(3 comments)

https://gerrit.asterisk.org/#/c/2525/1/res/res_pjsip/location.c
File res/res_pjsip/location.c:

Line 200: 	RAII_VAR(struct ast_named_lock *, lock, ast_named_lock_wrlock("aor", ast_sorcery_object_get_id(aor)), ast_named_lock_unlock);
This is not a good use of RAII_VAR as it can easily be written without it.


Line 329: 	RAII_VAR(struct ast_named_lock *, lock, ast_named_lock_wrlock("aor", ast_sorcery_object_get_id(aor)), ast_named_lock_unlock);
Same here


https://gerrit.asterisk.org/#/c/2525/1/res/res_pjsip_registrar.c
File res/res_pjsip_registrar.c:

Line 415: static int rx_task(void *data)
This function needs to be broken up because it is huge and because of the issues pointed out with the named lock API.

Also it could eliminate most of the RAII_VAR usage

Something like:
rx_task()
{
  task_data = data
  aor_name = ast_sorcery_object_get_id(task_data->aor)
  named_lock = ast_named_lock_get()
  if !named_lock {
     ao2_cleanup(task_data)
     return FALSE??
  }
  ao2_wrlock(named_lock)
  contacts = ast_sip_location_retrieve_aor_contacts_nolock()
  if !contacts {
     ao2_unlock(named_lock)
     ast_named_lock_put(named_lock)
     ao2_cleanup(task_data)
     return FALSE??
  }
  /* Everything else in rx_task() gets thrown into rx_task_core() */
  res = rx_task_core(task_data, contacts, aor_name)
  ao2_cleanup(contacts)
  ao2_unlock(named_lock)
  ast_named_lock_put(named_lock)
  ao2_cleanup(task_data)
  return res;
}


-- 
To view, visit https://gerrit.asterisk.org/2525
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I83d413c46a47796f3ab052ca3b349f21cca47059
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list