commit 4feceffdac093c3f7633821bb2e7b71084129ffa Author: Tzafrir Cohen Date: Mon Mar 31 20:32:29 2014 +0100 handle ENODEV on sig_pri diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index a3a82be..d7550d1 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -1149,7 +1149,6 @@ static void release_doomed_pris(void) { #ifdef HAVE_PRI /*! - * \internal * \brief Queue a span for destruction * \since 13.0 * @@ -1159,7 +1158,7 @@ static void release_doomed_pris(void) { * by the monitor thread. Allows destroying a span while holding its * lock. */ -static void pri_queue_for_destruction(struct sig_pri_span *pri) { +void pri_queue_for_destruction(struct sig_pri_span *pri) { struct doomed_pri *entry; int len = 0; diff --git a/channels/sig_pri.c b/channels/sig_pri.c index def6555..5628a7a 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -5961,6 +5961,14 @@ static void *pri_dchannel(void *vpri) } if (e) break; + + if ((errno != 0) && (errno != EINTR)) { + ast_log(LOG_NOTICE, "pri_check_event returned error %d (%s)\n", + errno, strerror(errno)); + } + if (errno == ENODEV) { + pri_queue_for_destruction(pri); + } } } else if (errno != EINTR) ast_log(LOG_WARNING, "pri_event returned error %d (%s)\n", errno, strerror(errno)); diff --git a/channels/sig_pri.h b/channels/sig_pri.h index ad6c4c5..1ea91bb 100644 --- a/channels/sig_pri.h +++ b/channels/sig_pri.h @@ -720,4 +720,6 @@ void sig_pri_cc_monitor_destructor(void *monitor_pvt); int sig_pri_load(const char *cc_type_name); void sig_pri_unload(void); +/* FIXME: this is not the right way to expose this function, I guess */ +void pri_queue_for_destruction(struct sig_pri_span *pri); #endif /* _SIG_PRI_H */