Skip to content

Conversation

@gmegidish
Copy link
Member

@gmegidish gmegidish commented Jan 18, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved iOS device connection reliability through enhanced port allocation and error handling
    • Added better cleanup mechanisms to prevent resource leaks on connection failures
  • Chores

    • Replaced fixed timeout values with configurable settings for more flexible device operations

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 18, 2026

Walkthrough

This PR introduces configurable port and timeout management for iOS device interactions. It replaces direct port allocation calls with range-based discovery, adds sequenced port forwarding for HTTP and H.264 streams, and replaces fixed sleep durations with configurable timeout constants.

Changes

Cohort / File(s) Summary
Port allocation and timeout configuration
devices/ios.go
Added new constants for port ranges (portRangeStart, portRangeEnd), target ports (deviceKitHTTPPort, deviceKitStreamPort), and timeouts (deviceKitAppLaunchTimeout, deviceKitBroadcastTimeout). Introduced findAvailablePortInRange() helper function to replace direct findAvailablePort() calls. Refactored port forwarding sequence to bind HTTP forwarder first, then stream port, with proper failure cleanup. Replaced fixed 5-second sleep durations with configurable timeout values and added verbose logging throughout the port-forwarding lifecycle.

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fixed race condition when creating two port forwarders' directly addresses the main change: resolving a race condition in port forwarding by introducing sequential port allocation, proper cleanup, and configurable timeouts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gmegidish
Copy link
Member Author

Done in another PR

@gmegidish gmegidish closed this Jan 18, 2026
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