/* allocate an entry for a speculative event. This can be done at any time. */
static inline void alloc_spec_entry(const int fd)
{
- if (fdtab[fd].spec_p)
+ if (fdtab[fd].cache)
/* FD already in speculative I/O list */
return;
fd_nbspec++;
- fdtab[fd].spec_p = fd_nbspec;
+ fdtab[fd].cache = fd_nbspec;
fd_spec[fd_nbspec-1] = fd;
}
{
unsigned int pos;
- pos = fdtab[fd].spec_p;
+ pos = fdtab[fd].cache;
if (!pos)
return;
- fdtab[fd].spec_p = 0;
+ fdtab[fd].cache = 0;
fd_nbspec--;
if (likely(pos <= fd_nbspec)) {
/* was not the last entry */
fd = fd_spec[fd_nbspec];
fd_spec[pos - 1] = fd;
- fdtab[fd].spec_p = pos;
+ fdtab[fd].cache = pos;
}
}
struct fdtab {
int (*iocb)(int fd); /* I/O handler, returns FD_WAIT_* */
void *owner; /* the connection or listener associated with this fd, NULL if closed */
- unsigned int spec_p; /* speculative polling: position in spec list+1. 0=not in list. */
- unsigned char state; /* FD state for read and write directions */
+ unsigned int cache; /* position+1 in the FD cache. 0=not in cache. */
+ unsigned char state; /* FD state for read and write directions (4+4 bits) */
unsigned char ev; /* event seen in return of poll() : FD_POLL_* */
unsigned char new:1; /* 1 if this fd has just been created */
unsigned char updated:1; /* 1 if this fd is already in the update list */
conn->flags,
conn->t.sock.fd,
conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].state : 0,
- conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].spec_p : 0,
+ conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].cache : 0,
conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].updated : 0);
}
else if ((tmpctx = objt_appctx(sess->si[0].end)) != NULL) {
conn->flags,
conn->t.sock.fd,
conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].state : 0,
- conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].spec_p : 0,
+ conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].cache : 0,
conn->t.sock.fd >= 0 ? fdtab[conn->t.sock.fd].updated : 0);
}
else if ((tmpctx = objt_appctx(sess->si[1].end)) != NULL) {
if (fdtab[fd].ev & FD_POLL_OUT)
fd_ev_set(fd, DIR_WR);
- if (fdtab[fd].spec_p) {
+ if (fdtab[fd].cache) {
/* This fd was already scheduled for being called as a speculative I/O */
continue;
}
if (fdtab[fd].ev & FD_POLL_OUT)
fd_ev_set(fd, DIR_WR);
- if (fdtab[fd].spec_p) {
+ if (fdtab[fd].cache) {
/* This fd was already scheduled for being
* called as a speculative I/O.
*/
if (fdtab[fd].ev & FD_POLL_OUT)
fd_ev_set(fd, DIR_WR);
- if (fdtab[fd].spec_p) {
+ if (fdtab[fd].cache) {
/* This fd was already scheduled for being
* called as a speculative I/O
*/
if (fdtab[fd].ev & FD_POLL_OUT)
fd_ev_set(fd, DIR_WR);
- if (fdtab[fd].spec_p) {
+ if (fdtab[fd].cache) {
/* This fd was already scheduled for being
* called as a speculative I/O.
*/