}
static unsigned tcp_set_ifaces(const iface_t *ifaces, size_t n_ifaces,
- fdset_t *fds, int thread_id, bool *tls)
+ fdset_t *fds, unsigned dt_thread_id, bool *tls)
{
if (n_ifaces == 0) {
return 0;
continue;
}
- int tcp_id = 0;
+ unsigned tcp_id = 0;
#ifdef ENABLE_REUSEPORT
if (conf()->cache.srv_tcp_reuseport && i->addr.ss_family != AF_UNIX) {
- /* Note: thread_ids start with UDP threads, TCP threads follow. */
- assert((i->fd_udp_count <= thread_id) &&
- (thread_id < i->fd_tcp_count + i->fd_udp_count));
-
- tcp_id = thread_id - i->fd_udp_count;
+ assert(dt_thread_id < i->fd_tcp_count);
+ tcp_id = dt_thread_id;
}
#endif
int ret = fdset_add(fds, i->fd_tcp[tcp_id], FDSET_POLLIN, (void *)i);
}
iohandler_t *handler = (iohandler_t *)thread->data;
- int thread_id = handler->thread_id[dt_get_id(thread)];
+ unsigned dt_thread_id = dt_get_id(thread);
+ unsigned thread_id = handler->thread_id[dt_thread_id];
#ifdef ENABLE_REUSEPORT
/* Set thread affinity to CPU core (overlaps with UDP/XDP). */
if (conf()->cache.srv_tcp_reuseport) {
unsigned cpu = dt_online_cpus();
if (cpu > 1) {
- unsigned cpu_mask = (dt_get_id(thread) % cpu);
+ unsigned cpu_mask = (dt_thread_id % cpu);
dt_setaffinity(thread, &cpu_mask, 1);
}
}
bool tls = false;
tcp.client_threshold = tcp_set_ifaces(handler->server->ifaces,
handler->server->n_ifaces,
- &tcp.set, thread_id, &tls);
+ &tcp.set, dt_thread_id, &tls);
if (tcp.client_threshold == 0) {
goto finish; /* Terminate on zero interfaces. */
}