samisagit / natskell

A NATS client library written in Haskell
MIT License
5 stars 0 forks source link

Discard invalid messages #109

Open samisagit opened 1 year ago

samisagit commented 1 year ago

The message handler needs to deal with the possibility that the socket read (or buffer read) will have an invalid, or overflowing message. In the former case all bytes before the next message keyword (INFO, MSG, PING...) is encountered.

In the latter case, if the message is at the start of the read, then it should be dropped. Otherwise the earlier messages should be dealt with to allow the entire size of the buffer for use with the overflowing message.

It would be good to add some tests covering this behaviour.