aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-21 23:39:31 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-21 23:39:31 +0000
commita632aee1694dd04080ce51add2519c10a8ff18bd (patch)
treef4a44ad7a993cb9bd908262db4de23aa8c7add71
parent3f232c3fb7d52e99ee0720f9f7fc77a48a991c9a (diff)
Fixes loop that could possibly never exit in the event of a channel never being able to be opened or specify after a restart.
(closes issue #11017) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@139387 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_dahdi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 125a971e1..e650ed291 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -7342,12 +7342,14 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
int chan_sig = conf->chan.sig;
if (!here) {
if ((channel != CHAN_PSEUDO) && !pri) {
+ int count = 0;
snprintf(fn, sizeof(fn), "%d", channel);
/* Open non-blocking */
tmp->subs[SUB_REAL].dfd = dahdi_open(fn);
- while (tmp->subs[SUB_REAL].dfd < 0 && reloading == 2) { /* the kernel may not call dahdi_release fast enough for the open flagbit to be cleared in time */
+ while (tmp->subs[SUB_REAL].dfd < 0 && reloading == 2 && count < 1000) { /* the kernel may not call dahdi_release fast enough for the open flagbit to be cleared in time */
usleep(1);
tmp->subs[SUB_REAL].dfd = dahdi_open(fn);
+ count++;
}
/* Allocate a DAHDI structure */
if (tmp->subs[SUB_REAL].dfd < 0) {