Fixed possible buf in proto.c
[yaz-moved-to-github.git] / server / eventl.c
index 1780a01..b9b88b5 100644 (file)
@@ -4,7 +4,17 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: eventl.c,v $
- * Revision 1.4  1995-03-14 16:59:48  quinn
+ * Revision 1.7  1995-03-27 15:02:01  quinn
+ * Added some includes for better portability
+ *
+ * Revision 1.6  1995/03/27  08:34:21  quinn
+ * Added dynamic server functionality.
+ * Released bindings to session.c (is now redundant)
+ *
+ * Revision 1.5  1995/03/15  08:37:41  quinn
+ * Now we're pretty much set for nonblocking I/O.
+ *
+ * Revision 1.4  1995/03/14  16:59:48  quinn
  * Bug-fixes
  *
  * Revision 1.3  1995/03/14  11:30:14  quinn
 #include <sys/types.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <errno.h>
+#include <string.h>
 
 #include <eventl.h>
 
-IOCHAN iochans = 0;
+#include <dmalloc.h>
+
+static IOCHAN iochans = 0;
+
+IOCHAN iochan_getchan(void)
+{
+    return iochans;
+}
 
 IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags)
 {
@@ -78,22 +97,24 @@ int event_loop()
                continue;
            return 1;
        }
-       if (!res)
-           continue;
-       for (p = iochans; p; p = nextp)
+       for (p = iochans; p; p = p->next)
        {
            int force_event = p->force_event;
 
            p->force_event = 0;
-           nextp = p->next;
            if (FD_ISSET(p->fd, &in) || force_event == EVENT_INPUT)
                (*p->fun)(p, EVENT_INPUT);
-           if (!p->destroyed && (FD_ISSET(p->fd, &in) ||
+           if (!p->destroyed && (FD_ISSET(p->fd, &out) ||
                 force_event == EVENT_OUTPUT))
                (*p->fun)(p, EVENT_OUTPUT);
            if (!p->destroyed && (FD_ISSET(p->fd, &except) ||
                force_event == EVENT_EXCEPT))
                (*p->fun)(p, EVENT_EXCEPT);
+       }
+       for (p = iochans; p; p = nextp)
+       {
+           nextp = p->next;
+
            if (p->destroyed)
            {
                IOCHAN tmp = p, pr;