sociomantic-tsunami / swarm

Asynchronous client/node framework library
Boost Software License 1.0
14 stars 26 forks source link

RecordStream: Correctly terminate on EOF #265

Closed mathias-lang-sociomantic closed 6 years ago

mathias-lang-sociomantic commented 6 years ago
Before this change, RecordStream would read an empty record before terminating,
because there was no way for `deserialize` to give feedback.
Now it correctly terminate without attempting to process an empty record.
In order to test it, we needed to close the non-used ends of the `pipe` in the test.
mathias-lang-sociomantic commented 6 years ago

I don't really get why this fix works.

The other method throws on EOF. This ones return false. Since the cstring is not populated when the call to readln returns false, splitRecord didn't do anything and we ended up passing an empty record to the output dg before this fix, which tripped some of our tools.

gavin-norman-sociomantic commented 6 years ago

The other method throws on EOF. This ones return false.

Ok. Is there any need to leave the exception handling code in fiberMethod then?

(By the way, I'm not disputing this change, just trying to understand what's going on so I can suggest a better way of documenting it.)

mathias-lang-sociomantic commented 6 years ago

Just checked, you are right, only StreamSerializer throws EofException.

mathias-lang-sociomantic commented 6 years ago

Ping ?