Chromium Code Reviews| Index: net/tools/quic/quic_dispatcher.cc |
| diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc |
| index 52778febec2f809abfc693937e1486aadaf5e3eb..aa930915223dcbea03803282cb0cbbb2030c271e 100644 |
| --- a/net/tools/quic/quic_dispatcher.cc |
| +++ b/net/tools/quic/quic_dispatcher.cc |
| @@ -296,21 +296,13 @@ void QuicDispatcher::OnCanWrite() { |
| // We got an EPOLLOUT: the socket should not be blocked. |
| writer_->SetWritable(); |
| - // Give each writer one attempt to write. |
| - int num_writers = write_blocked_list_.size(); |
| - for (int i = 0; i < num_writers; ++i) { |
| - if (write_blocked_list_.empty()) { |
| - return; |
| - } |
| + // Give all the blocked writers one chance to write, until we're blocked again |
| + // or there's no work left. |
| + while (!write_blocked_list_.empty() && !writer_->IsWriteBlocked()) { |
| QuicBlockedWriterInterface* blocked_writer = |
| write_blocked_list_.begin()->first; |
| write_blocked_list_.erase(write_blocked_list_.begin()); |
| blocked_writer->OnCanWrite(); |
| - if (writer_->IsWriteBlocked()) { |
| - // We were unable to write. Wait for the next EPOLLOUT. The writer is |
| - // responsible for adding itself to the blocked list via OnWriteBlocked(). |
| - return; |
| - } |
| } |
| } |
| @@ -352,9 +344,15 @@ void QuicDispatcher::OnConnectionClosed(QuicConnectionId connection_id, |
| CleanUpSession(it); |
| } |
| -void QuicDispatcher::OnWriteBlocked(QuicBlockedWriterInterface* writer) { |
| - DCHECK(writer_->IsWriteBlocked()); |
| - write_blocked_list_.insert(make_pair(writer, true)); |
| +void QuicDispatcher::OnWriteBlocked(QuicBlockedWriterInterface* blocked) { |
| + if (!writer_->IsWriteBlocked()) { |
| + LOG(DFATAL) << |
| + "QuicDispatcher::OnWriteBlocked called when the writer is not blocked."; |
| + // Return without adding the session to the blocked list, to avoid infinite |
|
wtc
2014/06/27 17:08:01
I believe |blocked| is a QuicConnection, not a Qui
ramant (doing other things)
2014/06/27 19:18:39
Done.
|
| + // loops in OnCanWrite |
| + return; |
| + } |
| + write_blocked_list_.insert(make_pair(blocked, true)); |
| } |
| QuicPacketWriter* QuicDispatcher::CreateWriter(int fd) { |