drain all udp packet
@@ -1821,11 +1821,13 @@ int Server::on_read() {
int rv;
ngtcp2_pkt_hd hd;
+ while (true) {
auto nread =
recvfrom(fd_, buf.data(), buf.size(), MSG_DONTWAIT, &su.sa, &addrlen);
if (nread == -1) {
+ if (!(errno == EAGAIN || errno == ENOTCONN)) {
std::cerr << "recvfrom: " << strerror(errno) << std::endl;
- // TODO Handle running out of fd
+ }
return 0;
}
@@ -1941,7 +1943,7 @@ int Server::on_read() {
default:
remove(handler_it);
}
-
+ }
return 0;
}
