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;
|
delete client;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
writecb(loop, &client->wev, revents);
|
client->signal_write();
|
||||||
// client->disconnect() and client->fail() may be called
|
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -601,7 +601,9 @@ int Client::read_quic() {
|
||||||
sockaddr_union su;
|
sockaddr_union su;
|
||||||
socklen_t addrlen = sizeof(su);
|
socklen_t addrlen = sizeof(su);
|
||||||
int rv;
|
int rv;
|
||||||
|
size_t pktcnt = 0;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
auto nread =
|
auto nread =
|
||||||
recvfrom(fd, buf.data(), buf.size(), MSG_DONTWAIT, &su.sa, &addrlen);
|
recvfrom(fd, buf.data(), buf.size(), MSG_DONTWAIT, &su.sa, &addrlen);
|
||||||
if (nread == -1) {
|
if (nread == -1) {
|
||||||
|
@ -622,14 +624,17 @@ int Client::read_quic() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worker->current_phase == Phase::MAIN_DURATION) {
|
if (pktcnt == 10) {
|
||||||
worker->stats.bytes_total += nread;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Client::write_quic() {
|
int Client::write_quic() {
|
||||||
|
ev_io_stop(worker->loop, &wev);
|
||||||
|
|
||||||
if (quic.close_requested) {
|
if (quic.close_requested) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue