mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge changes from team/russell/issue_9520
These changes make sure that the reference count for sip_peer objects properly reflects the fact that the peer is sitting in the scheduler for a scheduled callback for qualifying peers or for expiring registrations. Without this, it was possible for these callbacks to happen at the same time that the peer was being destroyed. This was especially likely to happen with realtime peers, and for people making use of the realtime prune CLI command. (closes issue #9520) Reported by: kryptolus Committed patch by me git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@114522 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -54,14 +54,17 @@ extern "C" {
|
||||
* macro should NOT be used.
|
||||
*/
|
||||
#define AST_SCHED_DEL(sched, id) \
|
||||
do { \
|
||||
({ \
|
||||
int _count = 0; \
|
||||
while (id > -1 && ast_sched_del(sched, id) && ++_count < 10) \
|
||||
int _sched_res = -1; \
|
||||
while (id > -1 && (_sched_res = ast_sched_del(sched, id)) && ++_count < 10) \
|
||||
usleep(1); \
|
||||
if (_count == 10 && option_debug > 2) \
|
||||
if (_count == 10 && option_debug > 2) { \
|
||||
ast_log(LOG_DEBUG, "Unable to cancel schedule ID %d.\n", id); \
|
||||
} \
|
||||
id = -1; \
|
||||
} while (0);
|
||||
(_sched_res); \
|
||||
})
|
||||
|
||||
struct sched_context;
|
||||
|
||||
|
Reference in New Issue
Block a user