From: Stefan Knoblich Date: Wed, 31 Aug 2011 23:45:06 +0000 (+0200) Subject: ftmod_libpri: Always try to close the d-channel to avoid a possible deadlock in case... X-Git-Tag: v1.2-rc1~51^2~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1a6fd27e098efb0c5fec652477821e39ff4281d;p=thirdparty%2Ffreeswitch.git ftmod_libpri: Always try to close the d-channel to avoid a possible deadlock in case something fails in the I/O module's channel open function. Signed-off-by: Stefan Knoblich --- diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index a379aeda9c..f31eafd42e 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1938,6 +1938,14 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) ftdm_sleep(5000); } out: + /* close d-channel, if set */ + if (isdn_data->dchan) { + if (ftdm_channel_close(&isdn_data->dchan) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Failed to close D-Channel %d:%d\n", + ftdm_channel_get_span_id(isdn_data->dchan), ftdm_channel_get_id(isdn_data->dchan)); + } + } + ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", ftdm_span_get_id(span)); ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD);