提交 43644d04 authored 作者: Anthony Minessale's avatar Anthony Minessale

exit thread if too many errors occur to prevent endless loop

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@850 a93c3328-9c30-0410-af19-c9cd2b2d52af
上级 786963c0
......@@ -922,14 +922,17 @@ static void *zap_analog_run(zap_thread_t *me, void *obj)
{
zap_span_t *span = (zap_span_t *) obj;
zap_analog_data_t *analog_data = span->signal_data;
int errs = 0;
zap_log(ZAP_LOG_DEBUG, "ANALOG thread starting.\n");
while(zap_running() && zap_test_flag(analog_data, ZAP_ANALOG_RUNNING)) {
int waitms = 1000;
zap_status_t status;
status = zap_span_poll_event(span, waitms);
if ((status = zap_span_poll_event(span, waitms)) != ZAP_FAIL) {
errs = 0;
}
switch(status) {
case ZAP_SUCCESS:
......@@ -948,6 +951,10 @@ static void *zap_analog_run(zap_thread_t *me, void *obj)
case ZAP_FAIL:
{
zap_log(ZAP_LOG_ERROR, "Failure Polling event! [%s]\n", span->last_error);
if (++errs > 300) {
zap_log(ZAP_LOG_CRIT, "Too Many Errors!\n");
goto end;
}
}
break;
default:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论