Optimize QUIC write
This commit is contained in:
parent
255c4905e6
commit
2c1022a336
|
@ -212,8 +212,7 @@ void readcb(struct ev_loop *loop, ev_io *w, int revents) {
|
|||
delete client;
|
||||
return;
|
||||
}
|
||||
writecb(loop, &client->wev, revents);
|
||||
// client->disconnect() and client->fail() may be called
|
||||
client->signal_write();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -601,7 +601,9 @@ int Client::read_quic() {
|
|||
sockaddr_union su;
|
||||
socklen_t addrlen = sizeof(su);
|
||||
int rv;
|
||||
size_t pktcnt = 0;
|
||||
|
||||
for (;;) {
|
||||
auto nread =
|
||||
recvfrom(fd, buf.data(), buf.size(), MSG_DONTWAIT, &su.sa, &addrlen);
|
||||
if (nread == -1) {
|
||||
|
@ -622,14 +624,17 @@ int Client::read_quic() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (worker->current_phase == Phase::MAIN_DURATION) {
|
||||
worker->stats.bytes_total += nread;
|
||||
if (pktcnt == 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Client::write_quic() {
|
||||
ev_io_stop(worker->loop, &wev);
|
||||
|
||||
if (quic.close_requested) {
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue