/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data
+ * Copyright (C) 1995-2012 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file eventl.c
* \brief Implements event loop handling for GFS.
* This source implements the main event loop for the Generic Frontend
* Server.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <errno.h>
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));
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;
{
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);