feat(listener): support unix socket listen#572
Conversation
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 143aa62a74
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds Unix domain socket listener support to rtp2httpd alongside the existing TCP listener flow, including config/CLI parsing, supervisor-owned Unix listener lifecycle, TCP-only socket option guards, and updated docs/OpenWrt UI plus new E2E coverage.
Changes:
- Add Unix-socket bind parsing (
--listen /abs/path.sockand[bind]/abs/path.sock) and supervisor-managed Unix listener setup/cleanup. - Guard TCP-specific socket options (TCP_NODELAY, TCP_USER_TIMEOUT, SO_ZEROCOPY) and treat Unix clients as
unixfor logging/status. - Update playlist URL port selection to ignore Unix binds; add E2E tests and update docs/OpenWrt LuCI/UCI help text.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/worker.c | Avoids applying TCP_NODELAY to Unix-socket accepted clients. |
| src/supervisor.c | Adds supervisor-owned Unix listeners and passes inherited fds to workers; updates reload logic and socket limits. |
| src/m3u.c | Selects first TCP bind for URL authority when Unix binds are present; avoids unsafe string ops. |
| src/connection.c | Disables TCP-only socket options for Unix clients; logs Unix clients as unix. |
| src/configuration.h | Introduces bind address type (TCP vs Unix) and helper to detect Unix binds. |
| src/configuration.c | Parses Unix bind paths from config/CLI, tracks bind types, and disables zerocopy when Unix listening is configured. |
| rtp2httpd.conf | Documents Unix socket binds in the default config template. |
| openwrt-support/rtp2httpd/files/rtp2httpd.conf | Updates OpenWrt UCI example comments for Unix socket listening. |
| openwrt-support/luci-app-rtp2httpd/po/zh_Hans/rtp2httpd.po | Updates Chinese UI strings describing valid listen formats. |
| openwrt-support/luci-app-rtp2httpd/po/templates/rtp2httpd.pot | Updates translation template strings for the new listen formats. |
| openwrt-support/luci-app-rtp2httpd/htdocs/luci-static/resources/view/rtp2httpd.js | Adds Unix socket parsing/validation and ignores Unix binds when choosing a primary TCP target. |
| e2e/test_unix_socket.py | New E2E coverage for Unix listener behavior (CLI/config, mixed binds, cleanup, zerocopy disablement). |
| e2e/test_fcc.py | Adds a defensive assertion that the rtp2httpd port is present for the test case. |
| e2e/helpers/r2h_process.py | Extends test harness to support Unix listen args and waiting on a Unix socket path. |
| e2e/helpers/ports.py | Adds a helper to wait for Unix socket readiness. |
| e2e/helpers/http.py | Adds raw-socket HTTP parsing helper and Unix-socket HTTP request helpers; refactors stream header parsing. |
| e2e/helpers/init.py | Exposes new Unix-socket test helpers from the helpers package. |
| docs/reference/configuration.md | Updates Chinese configuration docs to describe Unix socket listening behavior and constraints. |
| docs/en/reference/configuration.md | Updates English configuration docs to describe Unix socket listening behavior and constraints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net |
Summary
Adds Unix domain socket listener support alongside the existing TCP listener flow. Unix sockets use direct absolute path syntax in both
--listenand[bind], and supervisor-owned listener setup handles stale socket cleanup, non-socket path rejection, fd inheritance, and shutdown unlinking.This also disables zero-copy send globally whenever any Unix listener is configured, guards TCP-only socket options from Unix clients, shows Unix clients as
unix, ignores Unix binds when choosing fallback playlist ports, and updates docs plus OpenWrt LuCI/UCI help text.Validation
cmake --build build -j$(getconf _NPROCESSORS_ONLN)./scripts/run-e2e.sh test_unix_socket.py./scripts/run-e2e.shpnpm run docs:build