diff options
Diffstat (limited to 'net/tools/quic/test_tools/packet_dropping_test_writer.cc')
| -rw-r--r-- | net/tools/quic/test_tools/packet_dropping_test_writer.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/net/tools/quic/test_tools/packet_dropping_test_writer.cc b/net/tools/quic/test_tools/packet_dropping_test_writer.cc index ed46a07..3858b78 100644 --- a/net/tools/quic/test_tools/packet_dropping_test_writer.cc +++ b/net/tools/quic/test_tools/packet_dropping_test_writer.cc @@ -20,10 +20,9 @@ class WriteUnblockedAlarm : public QuicAlarm::Delegate { explicit WriteUnblockedAlarm(PacketDroppingTestWriter* writer) : writer_(writer) {} - QuicTime OnAlarm() override { + void OnAlarm() override { DVLOG(1) << "Unblocking socket."; writer_->OnCanWrite(); - return QuicTime::Zero(); } private: @@ -36,7 +35,12 @@ class DelayAlarm : public QuicAlarm::Delegate { public: explicit DelayAlarm(PacketDroppingTestWriter* writer) : writer_(writer) {} - QuicTime OnAlarm() override { return writer_->ReleaseOldPackets(); } + void OnAlarm() override { + QuicTime new_deadline = writer_->ReleaseOldPackets(); + if (new_deadline.IsInitialized()) { + writer_->SetDelayAlarm(new_deadline); + } + } private: PacketDroppingTestWriter* writer_; @@ -203,6 +207,10 @@ QuicTime PacketDroppingTestWriter::ReleaseOldPackets() { return QuicTime::Zero(); } +void PacketDroppingTestWriter::SetDelayAlarm(QuicTime new_deadline) { + delay_alarm_->Set(new_deadline); +} + void PacketDroppingTestWriter::OnCanWrite() { on_can_write_->OnCanWrite(); } |
