*/
static inline void updt_fd_polling(const int fd)
{
- if (fdtab[fd].updated)
+ if (fdtab[fd].update_mask & tid_bit)
/* already scheduled for update */
return;
- fdtab[fd].updated = 1;
+ fdtab[fd].update_mask |= tid_bit;
fd_updt[fd_nbupdt++] = fd;
}
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
fdtab[fd].ev = 0;
fdtab[fd].new = 1;
- fdtab[fd].updated = 0;
+ fdtab[fd].update_mask &= ~tid_bit;
fdtab[fd].linger_risk = 0;
fdtab[fd].cloned = 0;
fdtab[fd].cache = 0;
struct fdtab {
__decl_hathreads(HA_SPINLOCK_T lock);
unsigned long thread_mask; /* mask of thread IDs authorized to process the task */
+ unsigned long update_mask; /* mask of thread IDs having an update for fd */
void (*iocb)(int fd); /* I/O handler */
void *owner; /* the connection or listener associated with this fd, NULL if closed */
unsigned int cache; /* position+1 in the FD cache. 0=not in cache. */
unsigned char state; /* FD state for read and write directions (2*3 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 */
unsigned char linger_risk:1; /* 1 if we must kill lingering before closing */
unsigned char cloned:1; /* 1 if a cloned socket, requires EPOLL_CTL_DEL on close */
};
li = fdt.owner;
chunk_printf(&trash,
- " %5d : st=0x%02x(R:%c%c%c W:%c%c%c) ev=0x%02x(%c%c%c%c%c) [%c%c%c%c] cache=%u owner=%p iocb=%p(%s) tmask=0x%lx",
+ " %5d : st=0x%02x(R:%c%c%c W:%c%c%c) ev=0x%02x(%c%c%c%c%c) [%c%c%c] cache=%u owner=%p iocb=%p(%s) tmask=0x%lx umask=0x%lx",
fd,
fdt.state,
(fdt.state & FD_EV_POLLED_R) ? 'P' : 'p',
(fdt.ev & FD_POLL_PRI) ? 'P' : 'p',
(fdt.ev & FD_POLL_IN) ? 'I' : 'i',
fdt.new ? 'N' : 'n',
- fdt.updated ? 'U' : 'u',
fdt.linger_risk ? 'L' : 'l',
fdt.cloned ? 'C' : 'c',
fdt.cache,
(fdt.iocb == dgram_fd_handler) ? "dgram_fd_handler" :
(fdt.iocb == listener_accept) ? "listener_accept" :
"unknown",
- fdt.thread_mask);
+ fdt.thread_mask, fdt.update_mask);
if (fdt.iocb == conn_fd_handler) {
chunk_appendf(&trash, " cflg=0x%08x", conn_flags);
}
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
- fdtab[fd].updated = 0;
+ fdtab[fd].update_mask &= ~tid_bit;
fdtab[fd].new = 0;
eo = fdtab[fd].state;
}
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
- fdtab[fd].updated = 0;
+ fdtab[fd].update_mask &= ~tid_bit;
fdtab[fd].new = 0;
eo = fdtab[fd].state;
}
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
- fdtab[fd].updated = 0;
+ fdtab[fd].update_mask &= ~tid_bit;
fdtab[fd].new = 0;
eo = fdtab[fd].state;
}
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
- fdtab[fd].updated = 0;
+ fdtab[fd].update_mask &= ~tid_bit;
fdtab[fd].new = 0;
eo = fdtab[fd].state;
port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port);
fdinfo[fd].port_range = NULL;
fdtab[fd].owner = NULL;
- fdtab[fd].updated = 0;
+ fdtab[fd].update_mask &= ~tid_bit;
fdtab[fd].new = 0;
fdtab[fd].thread_mask = 0;
if (do_close)
conn->handle.fd,
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].state : 0,
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].cache : 0,
- conn->handle.fd >= 0 ? fdtab[conn->handle.fd].updated : 0,
+ conn->handle.fd >= 0 ? !!(fdtab[conn->handle.fd].update_mask & tid_bit) : 0,
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
}
else if ((tmpctx = objt_appctx(strm->si[0].end)) != NULL) {
conn->handle.fd,
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].state : 0,
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].cache : 0,
- conn->handle.fd >= 0 ? fdtab[conn->handle.fd].updated : 0,
+ conn->handle.fd >= 0 ? !!(fdtab[conn->handle.fd].update_mask & tid_bit) : 0,
conn->handle.fd >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
}
else if ((tmpctx = objt_appctx(strm->si[1].end)) != NULL) {