Skip to content

Pair on the server's existing connection to a client - #345

Merged
kahrendt merged 1 commit into
mainfrom
fix/pair-on-existing-connection
Nov 4, 2026
Merged

kahrendt merged 1 commit into
mainfrom
fix/pair-on-existing-connection

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

Multiple connections from one server to the same client were never explicitly invalid in the specification. This makes a server pair on the connection it already holds instead of opening a second one, since one connection can already carry ['playback', 'pairing']. When that connection can't carry the chosen method, such as a code-based pairing over a long-term PSK, the server closes it and reconnects.

A more general one connection per client rule is not needed, since a second playback connection from the same server already displaces the first one. It would also block a server from reconnecting before it notices the old connection is dead.

A server could pair over a second connection to a client it was
already connected to, and nothing defined what happened to the first
connection once pairing finished.

@kahrendt kahrendt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kahrendt
kahrendt merged commit d105023 into main Nov 4, 2026
1 check passed
@kahrendt
kahrendt deleted the fix/pair-on-existing-connection branch November 4, 2026 15:56
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Nov 16, 2026
…616)

# What does this implement/fix?

<!-- Quick description and explanation of changes. -->

Pairing a client while the server was reconnecting to it waited for that
whole session to end, because the attempt was queued for the next dial.
`connect_to_client` and `connect_to_client_and_wait` with a
`pairing_attempt` for a client that is already connected opened a second
connection to it.

Both now pair on the connection the server already holds.
`connect_to_client_and_wait` returns right away in that case, without
waiting for the pairing to finish.

**Related issue or spec PR (if applicable):**

- Sendspin/spec#345

## Types of changes

<!--
Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the
matching label, and the release notes use it to sort this change.
-->

- [x] Bugfix (non-breaking change which fixes an issue): `bugfix`
- [ ] New feature (non-breaking change which adds functionality):
`new-feature`
- [ ] Enhancement to an existing feature: `enhancement`
- [ ] Breaking change (changes the public API or the protocol in a way
that is not backwards compatible): `breaking-change`
- [ ] Refactor (no behavior change): `refactor`
- [ ] Documentation only: `documentation`
- [ ] Maintenance / chore: `maintenance`
- [ ] CI / workflow change: `ci`
- [ ] Dependencies bump: `dependencies`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants