Skip to content

Question about PacketFilterBase canPushPacket implementation  #962

@haug-den-lucas

Description

@haug-den-lucas

Hello,

I'm currently working with some Per-Stream Filtering and Policing in INET and stumbled upon the following lines of code:

bool PacketFilterBase::canPushPacket(Packet *packet, const cGate *gate) const
{
if (backpressure)
return matchesPacket(packet) && consumer != nullptr && consumer.canPushPacket(packet);
else
return !matchesPacket(packet) || consumer == nullptr || consumer.canPushPacket(packet);
}

In the no-backpressure case, this code accepts all packets in case its consumer accepts all packets.
However, if the consumer does not accept packets, canPushPacket returns true iff the packet criteria does not match, meaning it accepts all packets it will immediately filter out.
I cannot think about any scenario why this implementation would be useful.

Could you please clarify why it is implemented like this?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions