Repository navigation
feat(cameras): Pick the next free port when adding a stream endpoint - #566
Merged
Merged
Conversation
New endpoints used to always get the default port from preferences, so every camera added after the first collided on the receiver. The add button now uses the lowest port at or above the default that no camera's endpoints use, refreshing the device list from the backend first so streams this tab hasn't heard about yet still count. Closes #565 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Tekunalogy
marked this pull request as ready for review
October 15, 2026 21:23
Member
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #565
What
The + button on a camera's endpoint list used to always add the default endpoint from Preferences (usually
192.168.2.1:5600), so every new endpoint collided on the same port. Now it picks the lowest port at or above the default that no endpoint on any camera uses:How
getNextAvailablePort(devices, startPort)inlib/util/device.ts: collects used ports into aSetand counts up fromstartPort, O(n) in the number of endpoints.endpoint-list.tsx: on click, re-fetches/api/devices/mapfirst so ports used by streams this tab missed (stale tab, dropped socket event) still count, then adds the endpoint. The button is disabled while that runs, so a double click can't add two endpoints on the same port.Host is ignored when checking for collisions, to keep the rule simple. Backend is unchanged.
Testing
getNextAvailablePort: empty, gaps, ports across cameras, unordered, duplicates, ports below the default, custom defaulttsc -b,npm run build🤖 Generated with Claude Code