Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/event/dispatcher.h" 4 : #include "envoy/event/timer.h" 5 : 6 : #include "source/common/common/assert.h" 7 : 8 : #include "quiche/quic/core/quic_alarm.h" 9 : #include "quiche/quic/core/quic_clock.h" 10 : #include "quiche/quic/core/quic_time.h" 11 : 12 : namespace Envoy { 13 : namespace Quic { 14 : 15 : // Implements QUIC interface 16 : // https://quiche.googlesource.com/quiche/+/refs/heads/master/quic/core/quic_alarm.h This class 17 : // wraps an Event::Timer object and provide interface for QUIC to interact with the timer. 18 : class EnvoyQuicAlarm : public quic::QuicAlarm { 19 : public: 20 : EnvoyQuicAlarm(Event::Dispatcher& dispatcher, const quic::QuicClock& clock, 21 : quic::QuicArenaScopedPtr<quic::QuicAlarm::Delegate> delegate); 22 : 23 : // TimerImpl destruction deletes in-flight alarm firing event. 24 7725 : ~EnvoyQuicAlarm() override = default; 25 : 26 : // quic::QuicAlarm 27 : void CancelImpl() override; 28 : void SetImpl() override; 29 : // Overridden to avoid cancel before set. 30 : void UpdateImpl() override; 31 : 32 : private: 33 : quic::QuicTime::Delta getDurationBeforeDeadline(); 34 : 35 : Event::Dispatcher& dispatcher_; 36 : Event::TimerPtr timer_; 37 : const quic::QuicClock& clock_; 38 : }; 39 : 40 : } // namespace Quic 41 : } // namespace Envoy