mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Add ast_assert(), which can be used to handle fatal errors. It is only compiled
in if dev-mode is enabled, and only aborts if DO_CRASH is defined. (inspired by issue #12650) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@116463 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -433,7 +433,7 @@ static void jb_get_and_deliver(struct ast_channel *chan)
|
||||
return;
|
||||
default:
|
||||
ast_log(LOG_ERROR, "This should never happen!\n");
|
||||
CRASH;
|
||||
ast_assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
|
||||
bridged = ast_bridged_channel(chan);
|
||||
if (!bridged) {
|
||||
/* We should always have bridged chan if a jitterbuffer is in use */
|
||||
CRASH;
|
||||
ast_assert(0);
|
||||
}
|
||||
snprintf(name1, sizeof(name1), "%s", bridged->name);
|
||||
tmp = strchr(name1, '/');
|
||||
|
@@ -912,7 +912,7 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin)
|
||||
if (((fin->frametype == AST_FRAME_VOICE) && (qlen > 96)) || (qlen > 128)) {
|
||||
if (fin->frametype != AST_FRAME_VOICE) {
|
||||
ast_log(LOG_WARNING, "Exceptionally long queue length queuing to %s\n", chan->name);
|
||||
CRASH;
|
||||
ast_assert(0);
|
||||
} else {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Dropping voice to exceptionally long queue on %s\n", chan->name);
|
||||
@@ -1476,7 +1476,7 @@ int ast_hangup(struct ast_channel *chan)
|
||||
ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "
|
||||
"is blocked by thread %ld in procedure %s! Expect a failure\n",
|
||||
(long)pthread_self(), chan->name, (long)chan->blocker, chan->blockproc);
|
||||
CRASH;
|
||||
ast_assert(0);
|
||||
}
|
||||
if (!ast_test_flag(chan, AST_FLAG_ZOMBIE)) {
|
||||
if (option_debug)
|
||||
|
@@ -855,8 +855,7 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
|
||||
rtcpheader = (unsigned int *)(rtcpdata + AST_FRIENDLY_OFFSET);
|
||||
|
||||
if (res < 0) {
|
||||
if (errno == EBADF)
|
||||
CRASH;
|
||||
ast_assert(errno != EBADF);
|
||||
if (errno != EAGAIN) {
|
||||
ast_log(LOG_WARNING, "RTCP Read error: %s. Hanging up.\n", strerror(errno));
|
||||
return NULL;
|
||||
@@ -1134,8 +1133,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
|
||||
|
||||
rtpheader = (unsigned int *)(rtp->rawdata + AST_FRIENDLY_OFFSET);
|
||||
if (res < 0) {
|
||||
if (errno == EBADF)
|
||||
CRASH;
|
||||
ast_assert(errno != EBADF);
|
||||
if (errno != EAGAIN) {
|
||||
ast_log(LOG_WARNING, "RTP Read error: %s. Hanging up.\n", strerror(errno));
|
||||
return NULL;
|
||||
|
@@ -282,9 +282,7 @@ int ast_sched_del(struct sched_context *con, int id)
|
||||
if (!s) {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Attempted to delete nonexistent schedule entry %d!\n", id);
|
||||
#ifdef DO_CRASH
|
||||
CRASH;
|
||||
#endif
|
||||
ast_assert(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -639,8 +639,7 @@ struct ast_frame *ast_udptl_read(struct ast_udptl *udptl)
|
||||
if (res < 0) {
|
||||
if (errno != EAGAIN)
|
||||
ast_log(LOG_WARNING, "UDPTL read error: %s\n", strerror(errno));
|
||||
if (errno == EBADF)
|
||||
CRASH;
|
||||
ast_assert(errno != EBADF);
|
||||
return &ast_null_frame;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user