mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-25 08:02:54 -05:00
stream reuse toggle write and read to only read mode when write is done.
tcp callback from stream read without entry linked.
This commit is contained in:
parent
d89a45d1e1
commit
ccc9e0749c
2 changed files with 18 additions and 6 deletions
|
|
@ -887,6 +887,7 @@ outnet_tcp_cb(struct comm_point* c, void* arg, int error,
|
|||
reuse_tcp_remove_tree_list(outnet, &pend->reuse);
|
||||
} else if(error == NETEVENT_PKT_WRITTEN) {
|
||||
/* the packet we want to write has been written. */
|
||||
verbose(VERB_ALGO, "outnet tcp pkt was written event");
|
||||
log_assert(c == pend->c);
|
||||
log_assert(pend->query->pkt == pend->c->tcp_write_pkt);
|
||||
log_assert(pend->query->pkt_len == pend->c->tcp_write_pkt_len);
|
||||
|
|
@ -897,10 +898,14 @@ outnet_tcp_cb(struct comm_point* c, void* arg, int error,
|
|||
pend->query = NULL;
|
||||
/* setup to write next packet or setup read timeout */
|
||||
if(pend->reuse.write_wait_first) {
|
||||
verbose(VERB_ALGO, "outnet tcp setup next pkt");
|
||||
pend->query = reuse_write_wait_pop(&pend->reuse);
|
||||
outnet_tcp_take_query_setup(pend->c->fd, pend,
|
||||
pend->query);
|
||||
} else {
|
||||
verbose(VERB_ALGO, "outnet tcp writes done, wait");
|
||||
pend->c->tcp_write_and_read = 0;
|
||||
pend->c->tcp_is_reading = 1;
|
||||
reuse_tcp_setup_timeout(pend);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -926,10 +931,12 @@ outnet_tcp_cb(struct comm_point* c, void* arg, int error,
|
|||
}
|
||||
}
|
||||
if(pend->query) {
|
||||
reuse_tree_by_id_delete(&pend->reuse, pend->query);
|
||||
waiting_tcp_callback(pend->query, c, error, reply_info);
|
||||
waiting_tcp_delete(pend->query);
|
||||
struct waiting_tcp* w = pend->query;
|
||||
pend->query = NULL;
|
||||
reuse_tree_by_id_delete(&pend->reuse, w);
|
||||
verbose(5, "outnet tcp callback query err %d buflen %d", error, (int)sldns_buffer_limit(c->buffer));
|
||||
waiting_tcp_callback(w, c, error, reply_info);
|
||||
waiting_tcp_delete(w);
|
||||
}
|
||||
verbose(5, "outnet_tcp_cb reuse after cb");
|
||||
if(pend->reuse.node.key) {
|
||||
|
|
|
|||
|
|
@ -3307,11 +3307,16 @@ comm_point_start_listening(struct comm_point* c, int newfd, int msec)
|
|||
}
|
||||
if(c->type == comm_tcp || c->type == comm_http) {
|
||||
ub_event_del_bits(c->ev->ev, UB_EV_READ|UB_EV_WRITE);
|
||||
if(c->tcp_write_and_read)
|
||||
if(c->tcp_write_and_read) {
|
||||
log_info("startlistening %d mode rw", (newfd==-1?c->fd:newfd));
|
||||
ub_event_add_bits(c->ev->ev, UB_EV_READ|UB_EV_WRITE);
|
||||
else if(c->tcp_is_reading)
|
||||
} else if(c->tcp_is_reading) {
|
||||
log_info("startlistening %d mode r", (newfd==-1?c->fd:newfd));
|
||||
ub_event_add_bits(c->ev->ev, UB_EV_READ);
|
||||
else ub_event_add_bits(c->ev->ev, UB_EV_WRITE);
|
||||
} else {
|
||||
log_info("startlistening %d mode w", (newfd==-1?c->fd:newfd));
|
||||
ub_event_add_bits(c->ev->ev, UB_EV_WRITE);
|
||||
}
|
||||
}
|
||||
if(newfd != -1) {
|
||||
if(c->fd != -1 && c->fd != newfd) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue