rlm_radius_udp_t *inst; //!< IO submodule instance.
fr_event_list_t *el; //!< Event list.
- bool pending; //!< Are there pending requests?
-
fr_heap_t *queued; //!< Queued requests for some new connection.
fr_heap_t *active; //!< Active connections.
* responses, but we're happy to do it faster.
*/
conn_transition(c, CONN_ACTIVE);
- if (c->thread->pending) fd_active(c);
+ if (fr_heap_num_elements(c->thread->queued) > 0) fd_active(c);
break;
}
u->c = NULL;
(void) fr_heap_insert(c->thread->queued, u);
u->state = PACKET_STATE_THREAD;
- c->thread->pending = true;
}
fr_event_fd_delete(c->thread->el, fd, FR_EVENT_FILTER_IO);
* Now that we're open, assume that the connection is
* writable.
*/
- if (t->pending) conn_writable(c->thread->el, fd, 0, c);
+ if (fr_heap_num_elements(t->queued) > 0) conn_writable(c->thread->el, fd, 0, c);
return FR_CONNECTION_STATE_CONNECTED;
}
fr_dlist_remove(&u->entry);
(void) fr_heap_insert(t->queued, u);
u->state = PACKET_STATE_THREAD;
- t->pending = true;
}
switch (c->state) {
(void) fr_heap_insert(t->queued, u);
/*
- * There are other pending writes, wait for the event
+ * There are OTHER pending writes, wait for the event
* callbacks to wake up a connection and send the packet.
*/
- if (t->pending) {
+ if (fr_heap_num_elements(t->queued) > 1) {
DEBUG3("Thread has pending packets. Waiting for socket to be ready");
return RLM_MODULE_YIELD;
}
* or when an existing connection has
* availability.
*/
- t->pending = true;
return RLM_MODULE_YIELD;
}
t->inst = instance;
t->el = el;
- t->pending = false;
t->queued = fr_heap_create(queue_cmp, offsetof(rlm_radius_udp_request_t, heap_id));
FR_DLIST_INIT(t->blocked);
FR_DLIST_INIT(t->full);
ERROR("There are still queued requests");
return -1;
}
- rad_assert(t->pending == false);
/*
* Free all of the heaps, lists, and sockets.