| Index: net/quic/test_tools/simulator/traffic_policer.h
|
| diff --git a/net/quic/test_tools/simulator/traffic_policer.h b/net/quic/test_tools/simulator/traffic_policer.h
|
| index caa585594ce702fbe9d2104ad72e91a06f0eca37..3a218ae0a1af730640f4f558bd0eb48b0ee32fb8 100644
|
| --- a/net/quic/test_tools/simulator/traffic_policer.h
|
| +++ b/net/quic/test_tools/simulator/traffic_policer.h
|
| @@ -7,6 +7,7 @@
|
|
|
| #include <unordered_map>
|
|
|
| +#include "net/quic/test_tools/simulator/packet_filter.h"
|
| #include "net/quic/test_tools/simulator/port.h"
|
|
|
| namespace net {
|
| @@ -16,8 +17,8 @@ namespace simulator {
|
| // passing through. It wraps around an input port and exposes an output port.
|
| // Only the traffic from input to the output is policed, so in case when
|
| // bidirectional policing is desired, two policers have to be used. The flows
|
| -// are hashed by the source only.
|
| -class TrafficPolicer : public Actor, public ConstrainedPortInterface {
|
| +// are hashed by the destination only.
|
| +class TrafficPolicer : public PacketFilter {
|
| public:
|
| TrafficPolicer(Simulator* simulator,
|
| std::string name,
|
| @@ -27,28 +28,10 @@ class TrafficPolicer : public Actor, public ConstrainedPortInterface {
|
| Endpoint* input);
|
| ~TrafficPolicer() override;
|
|
|
| - Endpoint* input() { return input_; }
|
| - Endpoint* output() { return &output_; }
|
| -
|
| - void AcceptPacket(std::unique_ptr<Packet> packet) override;
|
| - QuicTime::Delta TimeUntilAvailable() override;
|
| -
|
| - void Act() override;
|
| + protected:
|
| + bool FilterPacket(const Packet& packet) override;
|
|
|
| private:
|
| - class Output : public Endpoint {
|
| - public:
|
| - explicit Output(TrafficPolicer* policer);
|
| - ~Output() override;
|
| -
|
| - UnconstrainedPortInterface* GetRxPort() override;
|
| - void SetTxPort(ConstrainedPortInterface* port) override;
|
| - void Act() override;
|
| -
|
| - private:
|
| - TrafficPolicer* policer_;
|
| - };
|
| -
|
| // Refill the token buckets with all the tokens that have been granted since
|
| // |last_refill_time_|.
|
| void Refill();
|
| @@ -60,11 +43,6 @@ class TrafficPolicer : public Actor, public ConstrainedPortInterface {
|
| // The time at which the token buckets were last refilled.
|
| QuicTime last_refill_time_;
|
|
|
| - ConstrainedPortInterface* output_tx_port_;
|
| -
|
| - Endpoint* input_;
|
| - Output output_;
|
| -
|
| // Maps each destination to the number of tokens it has left.
|
| std::unordered_map<std::string, QuicByteCount> token_buckets_;
|
|
|
|
|