diff options
author | rmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-09-02 21:08:41 +0000 |
---|---|---|
committer | rmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-09-02 21:08:41 +0000 |
commit | 4ad4edd7b293bf43ed7fd45ee4e8d6ee1f33518f (patch) | |
tree | e7333fcadcce11c687f6d7a055e2a7c63562738b /channels/sig_pri.c | |
parent | f5b5059f0fda1907bb353a4945149a02d11a29c6 (diff) |
Merged revisions 284779-284780 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r284779 | rmudgett | 2010-09-02 15:59:12 -0500 (Thu, 02 Sep 2010) | 8 lines
Made output libpri event names if pri debugging is enabled when sig_pri processes them.
* Simplified CLI "pri debug xx span xx" command code and removed redundant
debugging enabled messages.
* Made CLI "pri debug xx span xx" command only close the debugging log
file if it was opened.
........
r284780 | rmudgett | 2010-09-02 16:02:54 -0500 (Thu, 02 Sep 2010) | 2 lines
Simplified pri_dchannel() poll timeout duration code.
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@284782 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/sig_pri.c')
-rw-r--r-- | channels/sig_pri.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/channels/sig_pri.c b/channels/sig_pri.c index c42799624..c75badd66 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -4176,36 +4176,36 @@ static void *pri_dchannel(void *vpri) } } /* Start with reasonable max */ - lowest = ast_tv(60, 0); + if (doidling || pri->resetting) { + /* + * Make sure we stop at least once per second if we're + * monitoring idle channels + */ + lowest = ast_tv(1, 0); + } else { + /* Don't poll for more than 60 seconds */ + lowest = ast_tv(60, 0); + } for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) { - /* Find lowest available d-channel */ - if (!pri->dchans[i]) + if (!pri->dchans[i]) { + /* We scanned all D channels on this span. */ break; - if ((next = pri_schedule_next(pri->dchans[i]))) { + } + next = pri_schedule_next(pri->dchans[i]); + if (next) { /* We need relative time here */ tv = ast_tvsub(*next, ast_tvnow()); if (tv.tv_sec < 0) { - tv = ast_tv(0,0); + /* + * A timer has already expired. + * By definition zero time is the lowest so we can quit early. + */ + lowest = ast_tv(0, 0); + break; } - if (doidling || pri->resetting) { - if (tv.tv_sec > 1) { - tv = ast_tv(1, 0); - } - } else { - if (tv.tv_sec > 60) { - tv = ast_tv(60, 0); - } + if (ast_tvcmp(tv, lowest) < 0) { + lowest = tv; } - } else if (doidling || pri->resetting) { - /* Make sure we stop at least once per second if we're - monitoring idle channels */ - tv = ast_tv(1,0); - } else { - /* Don't poll for more than 60 seconds */ - tv = ast_tv(60, 0); - } - if (!i || ast_tvcmp(tv, lowest) < 0) { - lowest = tv; } } ast_mutex_unlock(&pri->lock); @@ -4243,8 +4243,10 @@ static void *pri_dchannel(void *vpri) ast_log(LOG_WARNING, "pri_event returned error %d (%s)\n", errno, strerror(errno)); if (e) { - if (pri->debug) - pri_dump_event(pri->dchans[which], e); + if (pri->debug) { + ast_verbose("Span: %d Processing event: %s\n", + pri->span, pri_event2str(e->e)); + } if (e->e != PRI_EVENT_DCHAN_DOWN) { if (!(pri->dchanavail[which] & DCHAN_UP)) { |