mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-01 03:09:28 -05:00
Fix reread of buffer data, better, also for TCP.
git-svn-id: file:///svn/unbound/trunk@5045 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
7c4911c577
commit
f5dcd84d27
1 changed files with 27 additions and 11 deletions
|
|
@ -1353,17 +1353,6 @@ ssl_handle_write(struct comm_point* c)
|
|||
static int
|
||||
ssl_handle_it(struct comm_point* c)
|
||||
{
|
||||
if(c->tcp_req_info) {
|
||||
do {
|
||||
int r;
|
||||
c->tcp_req_info->read_again = 0;
|
||||
if(c->tcp_is_reading)
|
||||
r = ssl_handle_read(c);
|
||||
else r = ssl_handle_write(c);
|
||||
if(!r) return r;
|
||||
} while (c->tcp_req_info->read_again);
|
||||
return 1;
|
||||
}
|
||||
if(c->tcp_is_reading)
|
||||
return ssl_handle_read(c);
|
||||
return ssl_handle_write(c);
|
||||
|
|
@ -1698,6 +1687,29 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** read again to drain buffers when there could be more to read */
|
||||
static void
|
||||
tcp_req_info_read_again(int fd, struct comm_point* c)
|
||||
{
|
||||
while(c->tcp_req_info->read_again) {
|
||||
int r;
|
||||
c->tcp_req_info->read_again = 0;
|
||||
if(c->tcp_is_reading)
|
||||
r = comm_point_tcp_handle_read(fd, c, 0);
|
||||
else r = comm_point_tcp_handle_write(fd, c);
|
||||
if(!r) {
|
||||
reclaim_tcp_handler(c);
|
||||
if(!c->tcp_do_close) {
|
||||
fptr_ok(fptr_whitelist_comm_point(
|
||||
c->callback));
|
||||
(void)(*c->callback)(c, c->cb_arg,
|
||||
NETEVENT_CLOSED, NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
comm_point_tcp_handle_callback(int fd, short event, void* arg)
|
||||
{
|
||||
|
|
@ -1736,6 +1748,8 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg)
|
|||
NETEVENT_CLOSED, NULL);
|
||||
}
|
||||
}
|
||||
if(c->tcp_req_info && c->tcp_req_info->read_again)
|
||||
tcp_req_info_read_again(fd, c);
|
||||
return;
|
||||
}
|
||||
if(event&UB_EV_WRITE) {
|
||||
|
|
@ -1748,6 +1762,8 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg)
|
|||
NETEVENT_CLOSED, NULL);
|
||||
}
|
||||
}
|
||||
if(c->tcp_req_info && c->tcp_req_info->read_again)
|
||||
tcp_req_info_read_again(fd, c);
|
||||
return;
|
||||
}
|
||||
if(event&UB_EV_TIMEOUT) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue