Hmm. I want to implement some IPC devices where one device might simply drop communications on the floor. My plan was to discover this with heartbeats, but that's going to require multi-threading, since our existing code uses blocking calls on these pipes to have conversations over the pipes that follow a strict protocol --theres no room for heartbeats in our existing code.
More-or-less our existing code:
https://gist.github.com/Groostav/970bdd65993b6acb8f1198fe1337e671
the problem is if I update my protocol to allow for these asynchronous Heartbeat messages, then the premise of
expect
becomes invalidated, at any point, rather than receive a response to the message that was just sent, it might recieve a response to a heartbeat.
can coroutines help me here? Can the
Channel
interface?