dont send boost restart when working sigmod is present

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@901 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva 2009-11-25 01:42:35 +00:00
parent 3b47c0786b
commit 360638f0dc
3 changed files with 34 additions and 22 deletions

View File

@ -246,13 +246,12 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
zap_status_t status = ZAP_FAIL;
sangoma_boost_request_id_t r;
sangomabc_event_t event = {0};
int sanity = 5000;
int boost_request_timeout = 5000;
sangoma_boost_request_status_t st;
char ani[128] = "";
char *gr = NULL;
uint32_t count = 0;
int tg=0;
if (zap_test_flag(span, ZAP_SPAN_SUSPENDED)) {
zap_log(ZAP_LOG_CRIT, "SPAN is not online.\n");
*zchan = NULL;
@ -340,12 +339,12 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
while(zap_running() && OUTBOUND_REQUESTS[r].status == BST_WAITING) {
zap_sleep(1);
if (--sanity <= 0) {
if (--boost_request_timeout <= 0) {
status = ZAP_FAIL;
*zchan = NULL;
zap_log(ZAP_LOG_CRIT, "Timed out waiting for boost channel request response\n");
goto done;
}
//printf("WTF %d\n", sanity);
}
if (OUTBOUND_REQUESTS[r].status == BST_READY && OUTBOUND_REQUESTS[r].zchan) {
@ -1160,6 +1159,9 @@ static zap_status_t zap_boost_connection_open(zap_span_t *span)
if (sangoma_boost_data->sigmod->start_span(span) != ZAP_SUCCESS) {
return ZAP_FAIL;
}
zap_clear_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RESTARTING);
zap_clear_flag_locked(span, ZAP_SPAN_SUSPENDED);
zap_clear_flag((&sangoma_boost_data->mcon), MSU_FLAG_DOWN);
}
sangoma_boost_data->pcon = sangoma_boost_data->mcon;
@ -1283,27 +1285,30 @@ static void *zap_sangoma_boost_run(zap_thread_t *me, void *obj)
}
init_outgoing_array();
sangomabc_exec_commandp(pcon,
0,
0,
-1,
SIGBOOST_EVENT_SYSTEM_RESTART,
0);
zap_set_flag(mcon, MSU_FLAG_DOWN);
if (!sangoma_boost_data->sigmod) {
sangomabc_exec_commandp(pcon,
0,
0,
-1,
SIGBOOST_EVENT_SYSTEM_RESTART,
0);
zap_set_flag(mcon, MSU_FLAG_DOWN);
}
while (zap_test_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING)) {
sangomabc_event_t *event = NULL;
int activity = 0;
if (!zap_running()) {
sangomabc_exec_commandp(pcon,
0,
0,
-1,
SIGBOOST_EVENT_SYSTEM_RESTART,
0);
zap_set_flag(mcon, MSU_FLAG_DOWN);
if (!sangoma_boost_data->sigmod) {
sangomabc_exec_commandp(pcon,
0,
0,
-1,
SIGBOOST_EVENT_SYSTEM_RESTART,
0);
zap_set_flag(mcon, MSU_FLAG_DOWN);
}
zap_log(ZAP_LOG_DEBUG, "zap is no longer running\n");
break;
}

View File

@ -75,7 +75,7 @@ static void sangomabc_print_event_call(sangomabc_connection_t *mcon, sangomabc_e
{
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
return;
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT: %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n",
zap_log(file, func, line, ZAP_LOG_LEVEL_DEBUG, "%s EVENT: %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n",
dir ? "TX":"RX",
sangomabc_event_id_name(event->event_id),
event->event_id,
@ -93,7 +93,7 @@ static void sangomabc_print_event_short(sangomabc_connection_t *mcon, sangomabc_
{
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
return;
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT (%s): %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i \n",
zap_log(file, func, line, ZAP_LOG_LEVEL_DEBUG, "%s EVENT (%s): %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i \n",
dir ? "TX":"RX",
priority ? "P":"N",
sangomabc_event_id_name(event->event_id),

View File

@ -29,6 +29,13 @@
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
*
* Moises Silva <moy@sangoma.com>
* David Yatzin <davidy@sangoma.com>
* Nenad Corbic <ncorbic@sangoma.com>
*
*/
#ifdef __sun
@ -62,7 +69,7 @@
#define sangoma_create_socket_intr sangoma_open_api_span_chan
#endif
/*! Starting with libsangoma 3 we can use the new libsangoma waitable API, the poor souls of those using a release were LIBSANGOMA version
/*! Starting with libsangoma 3 we can use the new libsangoma waitable API, the poor souls of those using a release where LIBSANGOMA version
* is defined but the version is not higher or equal to 3.0.0 will be forced to upgrade
* */
#ifdef LIBSANGOMA_VERSION