merge to sofia trunk (backport fixes from freeswitch and some new api's)

Thu Jan 24 03:26:58 EST 2008  Pekka.Pessi@nokia.com
  * nta.c, sofia-sip.nta.h: added nta_leg_get_seq(), nta_leg_get_rseq()

Mon Jan 28 09:27:03 EST 2008  Pekka.Pessi@nokia.com
  * su_alloc.c: su_free() handles NULL gracefully

  Patch by Michael Jerris.

Mon Jan 28 09:30:48 EST 2008  Pekka.Pessi@nokia.com
  * su_root.c: try not to segfault in su_msg_destroy()

  Reduced window for race condition in su_msg_destroy().

  Patch by Michael Jerris.



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7418 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-01-29 16:03:01 +00:00
parent 21e7c0253c
commit 7aafc21f14
4 changed files with 25 additions and 2 deletions

View File

@ -3920,6 +3920,18 @@ char const *nta_leg_get_rtag(nta_leg_t const *leg)
return NULL;
}
/** Get local request sequence number. */
uint32_t nta_leg_get_seq(nta_leg_t const *leg)
{
return leg ? leg->leg_seq : 0;
}
/** Get remote request sequence number. */
uint32_t nta_leg_get_rseq(nta_leg_t const *leg)
{
return leg ? leg->leg_rseq : 0;
}
/** Save target and route set at UAC side.
*
* @sa nta_leg_server_route(), @RFC3261 section 12.1.2

View File

@ -210,6 +210,12 @@ SOFIAPUBFUN char const *nta_leg_rtag(nta_leg_t *leg, char const *tag);
/** Get remote tag. */
SOFIAPUBFUN char const *nta_leg_get_rtag(nta_leg_t const *leg);
/** Get local request sequence number. @NEW_1_12_9 */
SOFIAPUBFUN uint32_t nta_leg_get_seq(nta_leg_t const *leg);
/** Get remote request sequence number. @NEW_1_12_9 */
SOFIAPUBFUN uint32_t nta_leg_get_rseq(nta_leg_t const *leg);
/** Set UAC route. */
SOFIAPUBFUN int nta_leg_client_route(nta_leg_t *leg,
sip_record_route_t const *route,

View File

@ -780,7 +780,9 @@ void *su_alloc(su_home_t *home, isize_t size)
*/
void su_free(su_home_t *home, void *data)
{
if (data) {
if (!data)
return;
if (home) {
su_alloc_t *allocation;
su_block_t *sub = MEMLOCK(home);

View File

@ -1046,10 +1046,13 @@ void su_msg_save(su_msg_r save, su_msg_r rmsg)
*/
void su_msg_destroy(su_msg_r rmsg)
{
su_msg_t *msg = rmsg[0];
su_msg_t *msg;
assert(rmsg);
rmsg[0] = NULL;
msg = rmsg[0], rmsg[0] = NULL;
if (msg) {
SU_TASK_ZAP(msg->sum_to, su_msg_destroy);
SU_TASK_ZAP(msg->sum_from, su_msg_destroy);