Using nxt_lvlhsh_peek() and nxt_lvlhsh_retrieve().
This commit is contained in:
@@ -96,30 +96,12 @@ nxt_fd_event_hash_delete(nxt_task_t *task, nxt_lvlhsh_t *lvlhsh, nxt_fd_t fd,
|
|||||||
void
|
void
|
||||||
nxt_fd_event_hash_destroy(nxt_lvlhsh_t *lvlhsh)
|
nxt_fd_event_hash_destroy(nxt_lvlhsh_t *lvlhsh)
|
||||||
{
|
{
|
||||||
nxt_int_t ret;
|
nxt_fd_event_t *ev;
|
||||||
nxt_fd_event_t *ev;
|
|
||||||
nxt_lvlhsh_each_t lhe;
|
|
||||||
nxt_lvlhsh_query_t lhq;
|
|
||||||
|
|
||||||
nxt_memzero(&lhe, sizeof(nxt_lvlhsh_each_t));
|
do {
|
||||||
lhe.proto = &nxt_event_set_fd_hash_proto;
|
ev = nxt_lvlhsh_retrieve(lvlhsh, &nxt_event_set_fd_hash_proto, NULL);
|
||||||
lhq.proto = &nxt_event_set_fd_hash_proto;
|
|
||||||
|
|
||||||
for ( ;; ) {
|
} while (ev != NULL);
|
||||||
ev = nxt_lvlhsh_each(lvlhsh, &lhe);
|
|
||||||
|
|
||||||
if (ev == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lhq.key_hash = nxt_murmur_hash2(&ev->fd, sizeof(nxt_fd_t));
|
|
||||||
|
|
||||||
ret = nxt_lvlhsh_delete(lvlhsh, &lhq);
|
|
||||||
|
|
||||||
if (nxt_slow_path(ret != NXT_OK)) {
|
|
||||||
nxt_fd_event_hash_error(ev->task, ev->fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -680,27 +680,15 @@ nxt_poll_fd_hash_test(nxt_lvlhsh_query_t *lhq, void *data)
|
|||||||
static void
|
static void
|
||||||
nxt_poll_fd_hash_destroy(nxt_event_engine_t *engine, nxt_lvlhsh_t *lh)
|
nxt_poll_fd_hash_destroy(nxt_event_engine_t *engine, nxt_lvlhsh_t *lh)
|
||||||
{
|
{
|
||||||
nxt_lvlhsh_each_t lhe;
|
|
||||||
nxt_lvlhsh_query_t lhq;
|
|
||||||
nxt_poll_hash_entry_t *phe;
|
nxt_poll_hash_entry_t *phe;
|
||||||
|
|
||||||
nxt_memzero(&lhe, sizeof(nxt_lvlhsh_each_t));
|
|
||||||
lhe.proto = &nxt_poll_fd_hash_proto;
|
|
||||||
lhq.proto = &nxt_poll_fd_hash_proto;
|
|
||||||
|
|
||||||
for ( ;; ) {
|
for ( ;; ) {
|
||||||
phe = nxt_lvlhsh_each(lh, &lhe);
|
phe = nxt_lvlhsh_retrieve(lh, &nxt_poll_fd_hash_proto, NULL);
|
||||||
|
|
||||||
if (phe == NULL) {
|
if (phe == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lhq.key_hash = nxt_murmur_hash2(&phe->fd, sizeof(nxt_fd_t));
|
|
||||||
|
|
||||||
if (nxt_lvlhsh_delete(lh, &lhq) != NXT_OK) {
|
|
||||||
nxt_alert(&engine->task, "event fd %d not found in hash", phe->fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
nxt_free(phe);
|
nxt_free(phe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -467,16 +467,11 @@ static nxt_buf_t nxt_port_close_dummy_buf;
|
|||||||
void
|
void
|
||||||
nxt_port_rpc_close(nxt_task_t *task, nxt_port_t *port)
|
nxt_port_rpc_close(nxt_task_t *task, nxt_port_t *port)
|
||||||
{
|
{
|
||||||
nxt_lvlhsh_each_t lhe;
|
|
||||||
nxt_port_rpc_reg_t *reg;
|
nxt_port_rpc_reg_t *reg;
|
||||||
nxt_port_recv_msg_t msg;
|
nxt_port_recv_msg_t msg;
|
||||||
|
|
||||||
for ( ;; ) {
|
for ( ;; ) {
|
||||||
nxt_memzero(&lhe, sizeof(nxt_lvlhsh_each_t));
|
reg = nxt_lvlhsh_peek(&port->rpc_streams, &lvlhsh_rpc_reg_proto);
|
||||||
|
|
||||||
lhe.proto = &lvlhsh_rpc_reg_proto;
|
|
||||||
|
|
||||||
reg = nxt_lvlhsh_each(&port->rpc_streams, &lhe);
|
|
||||||
if (reg == NULL) {
|
if (reg == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user