diff options
author | Corey Farrell <git@cfware.com> | 2015-03-19 09:57:59 +0000 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2015-03-19 09:57:59 +0000 |
commit | d48665950278b39f7c7f76f7e77572059243a086 (patch) | |
tree | 44ca5008b411369f6e8b687a4b59cc1bd5580187 /channels/sip | |
parent | 2c83ac436411df216da3ecd0b8b9ef3f01422f22 (diff) |
chan_sip: Simplify dialog/peer references, improve REF_DEBUG output.
* Replace functions for ref/undef of dialogs and peers with macro's
to call ao2_t_bump/ao2_t_cleanup.
* Enable passthough of REF_DEBUG caller information to sip_alloc and
find_call.
ASTERISK-24882 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4189/
........
Merged revisions 433115 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433116 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sip')
-rw-r--r-- | channels/sip/include/dialog.h | 15 | ||||
-rw-r--r-- | channels/sip/include/sip.h | 11 |
2 files changed, 11 insertions, 15 deletions
diff --git a/channels/sip/include/dialog.h b/channels/sip/include/dialog.h index 6b08109a1..beacdb989 100644 --- a/channels/sip/include/dialog.h +++ b/channels/sip/include/dialog.h @@ -29,13 +29,16 @@ * functions so we keep track of the refcounts. * To simplify the code, we allow a NULL to be passed to dialog_unref(). */ -#define dialog_ref(arg1,arg2) dialog_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__) -#define dialog_unref(arg1,arg2) dialog_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__) -struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func); -struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func); +#define dialog_ref(dialog, tag) ao2_t_bump(dialog, tag) +#define dialog_unref(dialog, tag) ({ ao2_t_cleanup(dialog, tag); (NULL); }) + +struct sip_pvt *__sip_alloc(ast_string_field callid, struct ast_sockaddr *sin, + int useglobal_nat, const int intended_method, struct sip_request *req, ast_callid logger_callid, + const char *file, int line, const char *func); + +#define sip_alloc(callid, addr, useglobal_nat, intended_method, req, logger_callid) \ + __sip_alloc(callid, addr, useglobal_nat, intended_method, req, logger_callid, __FILE__, __LINE__, __PRETTY_FUNCTION__) -struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *sin, - int useglobal_nat, const int intended_method, struct sip_request *req, ast_callid logger_callid); void sip_scheddestroy_final(struct sip_pvt *p, int ms); void sip_scheddestroy(struct sip_pvt *p, int ms); int sip_cancel_destroy(struct sip_pvt *p); diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h index ab682ebfa..24bb2396e 100644 --- a/channels/sip/include/sip.h +++ b/channels/sip/include/sip.h @@ -1869,14 +1869,7 @@ void sip_auth_headers(enum sip_auth_type code, char **header, char **respheader) const char *sip_get_header(const struct sip_request *req, const char *name); const char *sip_get_transport(enum ast_transport t); -#ifdef REF_DEBUG -#define sip_ref_peer(arg1,arg2) _ref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__) -#define sip_unref_peer(arg1,arg2) _unref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__) -struct sip_peer *_ref_peer(struct sip_peer *peer, char *tag, char *file, int line, const char *func); -void *_unref_peer(struct sip_peer *peer, char *tag, char *file, int line, const char *func); -#else -struct sip_peer *sip_ref_peer(struct sip_peer *peer, char *tag); -void *sip_unref_peer(struct sip_peer *peer, char *tag); -#endif /* REF_DEBUG */ +#define sip_ref_peer(peer, tag) ao2_t_bump(peer, tag) +#define sip_unref_peer(peer, tag) ({ ao2_t_cleanup(peer, tag); (NULL); }) #endif |