I may be able to answer my own question: If let (datagrams, error) = await flow.readDatagrams() returns no error and no datagrams (i.e. an empty array) I assume the flow should get closed.
If I don't close the flow upon a read with empty datagrams (and empty error) I get an endless read loop resulting in high CPU usage, so I assume that the flow should get closed in that case.
For most flows this results in a similar behaviour to just calling readDatagrams once, because consecutive calls would result in returning empty Datagrams, but I reckon for some flows it is important to continue reading.
@DTS Engineer if closing the flow upon not receiving datagrams is not correct please let me know how to handle the end of lifecycle differently.
Topic:
App & System Services
SubTopic:
Networking
Tags: