MEDIUM: polling: prepare to call the iocb() function when defined.
We will need this to centralize I/O callbacks. Nobody sets it right
now so the code should have no impact.
diff --git a/src/ev_select.c b/src/ev_select.c
index 64031cc..b1c41bc 100644
--- a/src/ev_select.c
+++ b/src/ev_select.c
@@ -146,19 +146,25 @@
/* if we specify read first, the accepts and zero reads will be
* seen first. Moreover, system buffers will be flushed faster.
*/
+ fdtab[fd].ev &= FD_POLL_STICKY;
if (FD_ISSET(fd, tmp_evts[DIR_RD])) {
if (!fdtab[fd].owner)
continue;
fdtab[fd].ev |= FD_POLL_IN;
- fdtab[fd].cb[DIR_RD].f(fd);
+ if (fdtab[fd].cb[DIR_RD].f)
+ fdtab[fd].cb[DIR_RD].f(fd);
}
if (FD_ISSET(fd, tmp_evts[DIR_WR])) {
if (!fdtab[fd].owner)
continue;
fdtab[fd].ev |= FD_POLL_OUT;
- fdtab[fd].cb[DIR_WR].f(fd);
+ if (fdtab[fd].cb[DIR_WR].f)
+ fdtab[fd].cb[DIR_WR].f(fd);
}
+
+ if (fdtab[fd].iocb && fdtab[fd].owner && fdtab[fd].ev)
+ fdtab[fd].iocb(fd);
}
}
}