Skip to content

refactor(http): shared non-blocking libcurl reactor - #229

Merged
MisterVVP merged 4 commits into
dev-make-libcurl-streaming-cancellation-event-drivenfrom
dev-implement-shared-non-blocking-libcurl-reactor
Aug 29, 2026
Merged

MisterVVP merged 4 commits into
dev-make-libcurl-streaming-cancellation-event-drivenfrom
dev-implement-shared-non-blocking-libcurl-reactor

Conversation

@MisterVVP

@MisterVVP MisterVVP commented Aug 28, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • Replace the previous per-stream blocking libcurl event loop with a single shared non-blocking reactor owned per HTTP client to avoid one blocked I/O worker per stream and to drive socket readiness from the kernel.
  • Implement a Linux-ready event backend using epoll, eventfd, and timerfd and preserve synchronous a2a::http::Client::StreamRequest() semantics while keeping custom requester compatibility.
  • Authorship: AI agent

Description

  • Added a client-scoped CurlStreamReactor that owns one CURLM*, a reactor thread, a synchronized command queue, active transfer registrations, and shutdown state, and that serializes Add/Cancel/Shutdown commands to the reactor thread (implemented in src/http/http_client.cpp).
  • Implemented Linux readiness using epoll + eventfd wakeups + timerfd and forwarded socket/timer events into curl_multi_socket_action() without fixed polling intervals; added a portable fallback that uses libcurl multi wakeups on non-Linux platforms.
  • Reworked streaming transfer flow: PerformStreamingTransfer now enqueues a Transfer with the client reactor and waits on the transfer completion condition instead of creating a per-stream CURLM and blocking per-stream polling. Client now creates/holds a shared reactor (state_->stream_reactor).
  • Removed per-stream curl_multi_* ownership/cleanup and updated stream slot acquisition to only create per-easy handle slots; documented the default HTTP reactor behavior in docs/streaming-usage.md.

@MisterVVP MisterVVP added the codex Automatic label added by codex agent. Should not be used label Aug 28, 2026 — with ChatGPT Codex Connector
@MisterVVP MisterVVP self-assigned this Aug 28, 2026
@MisterVVP MisterVVP added AI agent AI agent contribution performance Performance improvement related tasks based on benchmark results. Performance tests changes. and removed codex Automatic label added by codex agent. Should not be used labels Aug 28, 2026
@MisterVVP
MisterVVP marked this pull request as draft August 28, 2026 20:11
@MisterVVP
MisterVVP marked this pull request as ready for review August 29, 2026 08:54
@MisterVVP
MisterVVP merged commit 19f3b5f into dev-make-libcurl-streaming-cancellation-event-driven Aug 29, 2026
19 checks passed
@MisterVVP
MisterVVP deleted the dev-implement-shared-non-blocking-libcurl-reactor branch August 29, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI agent AI agent contribution performance Performance improvement related tasks based on benchmark results. Performance tests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant