Skip to content

feat(listener): support unix socket listen#572

Merged
stackia merged 6 commits into
mainfrom
codex/unix-socket-listener
Jun 24, 2026
Merged

feat(listener): support unix socket listen#572
stackia merged 6 commits into
mainfrom
codex/unix-socket-listener

Conversation

@stackia

@stackia stackia commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Adds Unix domain socket listener support alongside the existing TCP listener flow. Unix sockets use direct absolute path syntax in both --listen and [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.sh
  • pnpm run docs:build

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net

@stackia stackia marked this pull request as ready for review June 24, 2026 20:14
@stackia stackia requested a review from Copilot June 24, 2026 20:14
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/supervisor.c Outdated

Copilot AI 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.

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.sock and [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 unix for 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.

Comment thread src/supervisor.c
Comment thread e2e/helpers/http.py
Comment thread docs/en/reference/configuration.md
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net

Copilot AI 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.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Comment thread src/supervisor.c Outdated
Comment thread src/unix_socket.c Outdated
Comment thread docs/en/reference/configuration.md
Comment thread src/unix_socket.c
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-572.eastasia.1.azurestaticapps.net

Copilot AI 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.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.

Comment thread e2e/helpers/http.py
Comment thread e2e/helpers/http.py
Comment thread docs/en/reference/configuration.md
Comment thread src/unix_socket.c
@stackia stackia merged commit 67dfc84 into main Jun 24, 2026
12 of 13 checks passed
@stackia stackia deleted the codex/unix-socket-listener branch June 24, 2026 21:21
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