Skip to content

Send session.bye before marking the client closed #33

@nficano

Description

@nficano

Arcp::Client#close sets @closed = true at lib/arcp/client.rb:214 before it attempts to send session.bye at lib/arcp/client.rb:216. Because send_envelope raises IOError, 'client closed' when @closed is true at lib/arcp/client.rb:200, the bye send always fails and is swallowed by the broad close rescue. The transport is closed afterward, so the peer eventually notices EOF, but it never receives the protocol-level close reason that the method accepts and the sessions guide says is sent.

Fix prompt: Send session.bye while the client still permits outbound frames, then mark the client closed before stopping tasks and closing the transport. Keep close idempotent and retain best-effort behavior when the transport is already broken. Add a unit or integration spec using MemoryTransport#sent to assert that client.close(reason: 'done') emits a session.bye envelope with the reason exactly once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:lowLow severity

    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