Fixed the asn1 for facets
[yaz-moved-to-github.git] / src / eventl.c
index f2963a1..5e219ca 100644 (file)
@@ -1,8 +1,6 @@
-/*
- * Copyright (C) 1995-2007, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2010 Index Data
  * See the file LICENSE for details.
- *
- * $Id: eventl.c,v 1.17 2007-11-30 11:44:47 adam Exp $
  */
 
 /**
@@ -31,6 +29,7 @@
 #include <yaz/log.h>
 #include <yaz/comstack.h>
 #include <yaz/xmalloc.h>
+#include <yaz/errno.h>
 #include "eventl.h"
 #include "session.h"
 #include <yaz/statserv.h>
@@ -118,8 +117,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;
@@ -139,15 +139,9 @@ int iochan_event_loop(IOCHAN *iochans)
             }
             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);
@@ -217,6 +211,7 @@ int iochan_event_loop(IOCHAN *iochans)
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab