funcmike / rabbitmq-nio

A Swift implementation of AMQP 0.9.1 protocol: decoder + encoder and non-blocking client
Apache License 2.0
44 stars 8 forks source link

More robust handling of unexpected payloads #36

Open sliemeobn opened 1 year ago

sliemeobn commented 1 year ago

Currently unexpected payloads sent by the broker will result in either a crash (precondition) or undefined behavior, because it is basically ignored.

All preconditions that can actually occur should rather cause an error and take the channel down cleanly (eg: a valid frame from the broker that is unexpected).

On the other hand, valid broker response frames that arrive without a matching requests are ignored - or worse, just forwarded up the chain to a mismatching request - only to be then converted to an error (outside of the channel handling pipeline).

Ideally, the channel pipeline understands these mismatches and also cleanly takes the channel down with an error.