Skip to content

turnloop-mongodb gives no way to ask a Connection what state it is in #70

Description

@proggeramlug

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions