X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Feventl.c;h=3075d5973ba9f6c43eb9a542437d36871227ceda;hp=2d642ca637fe02213de6c846e4e609ad2089041a;hb=11af92513c72d3eb1e618e658b9418a42f4a630f;hpb=379504a233e3e2cc85bca1e7b6d864f1395aec7c diff --git a/src/eventl.c b/src/eventl.c index 2d642ca..3075d59 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -1,8 +1,7 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2009 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ - /** * \file eventl.c * \brief Implements event loop handling for GFS. @@ -10,6 +9,9 @@ * This source implements the main event loop for the Generic Frontend * Server. */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -29,6 +31,7 @@ #include #include #include +#include #include "eventl.h" #include "session.h" #include @@ -87,11 +90,6 @@ int iochan_event_loop(IOCHAN *iochans) int res; time_t now = time(0); - if (statserv_must_terminate()) - { - for (p = *iochans; p; p = p->next) - p->force_event = EVENT_TIMEOUT; - } for (p = *iochans; p; p = p->next) no_fds++; fds = (struct yaz_poll_fd *) xmalloc(no_fds * sizeof(*fds)); @@ -116,8 +114,9 @@ int iochan_event_loop(IOCHAN *iochans) w = p->max_idle; else w = ftime - now; + /* tv_sec will be minimum wait.. */ if (w < tv_sec) - tv_sec = w; + tv_sec = (int) w; /* can hold it because w < tv_sec */ } fds[i].fd = p->fd; fds[i].input_mask = input_mask; @@ -127,25 +126,14 @@ int iochan_event_loop(IOCHAN *iochans) { if (yaz_errno() == EINTR) { - if (statserv_must_terminate()) - { - for (p = *iochans; p; p = p->next) - p->force_event = EVENT_TIMEOUT; - } xfree(fds); continue; } else { - /* Destroy the first member in the chain, and try again */ - association *assoc = (association *)iochan_getdata(*iochans); - COMSTACK conn = assoc->client_link; - - cs_close(conn); - destroy_association(assoc); - iochan_destroy(*iochans); - yaz_log(log_level, "error select, destroying iochan %p", - *iochans); + yaz_log(YLOG_WARN|YLOG_ERRNO, "yaz_poll"); + xfree(fds); + continue; } } now = time(0);