| Index: net/tools/quic/quic_simple_server.cc
|
| diff --git a/net/tools/quic/quic_simple_server.cc b/net/tools/quic/quic_simple_server.cc
|
| index 91a000b98e7722b8181b0a12be9da2751bc6af35..36a174c7a2a13a10572b5519d2a1ec243a447ef4 100644
|
| --- a/net/tools/quic/quic_simple_server.cc
|
| +++ b/net/tools/quic/quic_simple_server.cc
|
| @@ -27,6 +27,7 @@ namespace net {
|
| namespace {
|
|
|
| const char kSourceAddressTokenSecret[] = "secret";
|
| +const size_t kNumSessionsToCreatePerSocketEvent = 16;
|
|
|
| // Allocate some extra space so we can send an error if the client goes over
|
| // the limit.
|
| @@ -147,6 +148,11 @@ void QuicSimpleServer::Shutdown() {
|
| }
|
|
|
| void QuicSimpleServer::StartReading() {
|
| + if (synchronous_read_count_ == 0) {
|
| + // Only process buffered packets once per message loop.
|
| + dispatcher_->ProcessBufferedChlos(kNumSessionsToCreatePerSocketEvent);
|
| + }
|
| +
|
| if (read_pending_) {
|
| return;
|
| }
|
| @@ -158,6 +164,12 @@ void QuicSimpleServer::StartReading() {
|
|
|
| if (result == ERR_IO_PENDING) {
|
| synchronous_read_count_ = 0;
|
| + if (dispatcher_->HasChlosBuffered()) {
|
| + // No more packets to read, so yield before processing buffered packets.
|
| + base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| + FROM_HERE, base::Bind(&QuicSimpleServer::StartReading,
|
| + weak_factory_.GetWeakPtr()));
|
| + }
|
| return;
|
| }
|
|
|
|
|