Skip to content

SSH module async#2

Open
precla wants to merge 37 commits intomainfrom
libssh_libuv
Open

SSH module async#2
precla wants to merge 37 commits intomainfrom
libssh_libuv

Conversation

@precla
Copy link
Copy Markdown
Collaborator

@precla precla commented Aug 25, 2025

stratoweave/stratoweave#5

This solution uses libuv's polls to handle incoming data.

Compared to the solution in MR1 , it can handle buffers of smaller size: #define BUF_SIZE 512 can be any value. Since it will append the response until it's EOF. THe MR1 solution had the issue that it would only process once and if something doesn't fit in the predefined buffer, then it would just drop it.

Another change is that this solution uses only actor Client and no more Channel actor.

The Client does everything: setup the connection (ssh or netconf), send a payload and get the response

See comment: #2 (comment)

@precla precla mentioned this pull request Apr 1, 2026
Replace the synchronous blocking model (uv_run per operation) with an
async callback-driven architecture that integrates with the Acton RTS
event loop. The Client actor now exposes write()/close() methods and
delivers data via on_receive, on_error, and on_remote_close callbacks
instead of the previous get/set_payload + send_payload pattern.

Key changes:
  - Use get_uv_loop() (RTS loop) instead of private per-client uv loops
  - Simplify C state machine: AUTH → AUTH_KBDINT → CHANNEL_OPEN → REQUEST_TYPE → READY
  - Add keyboard-interactive auth fallback when password auth is denied
  - Add buffered async writes with partial-write handling
  - Make password and subsystem optional; support shell or subsystem channels
  - Remove fallthrough between states so each transition gets its own poll cycle
  - Rewrite main actor with a NETCONF state machine example
  - Add Build.act with libssh zig dependency

Signed-off-by: Antonio Prcela <antonio.prcela@sartura.hr>
@precla
Copy link
Copy Markdown
Collaborator Author

precla commented Apr 1, 2026

Build.act currently points to a fork: https://github.com/precla/libssh/archive/refs/heads/zig-build.tar.gz

Once actonlang/libssh/pull/3 is merged, it can point to it instead of the fork

@precla
Copy link
Copy Markdown
Collaborator Author

precla commented Apr 1, 2026

Changes in latest commit.

Redesign SSH Client to async event-driven API using RTS event loop

Replace the synchronous blocking model (uv_run per operation) with an
async callback-driven architecture that integrates with the Acton RTS
event loop. The Client actor now exposes write()/close() methods and
delivers data via on_receive, on_error, and on_remote_close callbacks
instead of the previous get/set_payload + send_payload pattern.

Key changes:

  • Use get_uv_loop() (RTS loop) instead of private per-client uv loops
  • Simplify C state machine: AUTH → AUTH_KBDINT → CHANNEL_OPEN → REQUEST_TYPE → READY
  • Add keyboard-interactive auth fallback when password auth is denied
  • Add buffered async writes with partial-write handling
  • Make password and subsystem optional; support shell or subsystem channels
  • Remove fallthrough between states so each transition gets its own poll cycle
  • Rewrite main actor with a NETCONF state machine example
  • Add Build.act with libssh zig dependency

Requires latest actonlang libssh build: actonlang/libssh#3

precla added 2 commits April 1, 2026 09:20
Signed-off-by: Antonio Prcela <antonio.prcela@sartura.hr>
Signed-off-by: Antonio Prcela <antonio.prcela@sartura.hr>
@precla precla requested a review from plajjan April 1, 2026 07:22
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