Problem
turnloop-mongodb's Connection gives a host no way to ask what state it is in. receive() errors out if the connection is not currently expecting a reply, and the only state accessor exposed at all is is_ready(). Every other state the connection can be in is invisible from outside.
Why it matters
Every host of this crate ends up shadowing the connection's own internal state machine with a separate expecting_reply flag (or equivalent) purely so it can decide whether it is safe to call receive() — duplicating state the connection already tracks internally, with the two copies free to drift apart.
What would fix it
An accepts_receive() -> bool (or similarly named state query) that reports the same thing the connection checks internally before accepting a reply, removing the need for hosts to duplicate that tracking.
Problem
turnloop-mongodb'sConnectiongives a host no way to ask what state it is in.receive()errors out if the connection is not currently expecting a reply, and the only state accessor exposed at all isis_ready(). Every other state the connection can be in is invisible from outside.Why it matters
Every host of this crate ends up shadowing the connection's own internal state machine with a separate
expecting_replyflag (or equivalent) purely so it can decide whether it is safe to callreceive()— duplicating state the connection already tracks internally, with the two copies free to drift apart.What would fix it
An
accepts_receive() -> bool(or similarly named state query) that reports the same thing the connection checks internally before accepting a reply, removing the need for hosts to duplicate that tracking.