python-suitcase icon indicating copy to clipboard operation
python-suitcase copied to clipboard

Restrict how many packet callbacks can be called

Open harlowja opened this issue 10 years ago • 2 comments

Sometimes you only want to unpack 3 (for example) objects from a stream and stop unpacking after that many, it appears the current StreamProtocolHandler will continue unpacking forever, vs unpacking 3 and then stopping. It'd be nice to be able to restrict it to a given amount of unpacks (and default to infinite to retain the existing behavior)

harlowja avatar Nov 26 '15 01:11 harlowja

Interesting. I wonder if this might be better handled outside of Suitcase? Presumably, once you have received N packet callbacks, you could just stop feeding in bytes to feed().

What would "stopping" after 3 frames look like? How would the behavior of feed() change?

posborne avatar Nov 30 '15 18:11 posborne

Ah, good point, might not be needed.

harlowja avatar Nov 30 '15 19:11 harlowja