Skip to content

Smarter reconnection handling for msg queues #5

@Wondertan

Description

@Wondertan

Context

Messenger manages a per-peer queue of messages. Those queues are not cleaned up right now if a peer disconnects, which is technically a bug.

However, the goal is to allow queues to live for some configurable amount of time if peer disconnects, so once it reconnects the same queue is reused and writing of outstanding msgs restarts.

Unfortunately, there is a chance for messages to be lost, as any msg written to a libp2p stream can return a success, while in fact it was not send. This is happening because of the non-blocking API of stream writes in libp2p. I.e. a case possible where a connection can be closed right after a successful write, but the write itself was buffered and wasn't written to the closed connection.

Therefore, there is no precise way for Messenger to know which message has to be resent on reconnect, because a msg could be written to the stream, return success, but in fact lost forever.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions