Skip to content

Add TestServer.SSH#54

Open
richard-ash wants to merge 1 commit intorichard/refactor-http-websocketfrom
richard/add-ssh
Open

Add TestServer.SSH#54
richard-ash wants to merge 1 commit intorichard/refactor-http-websocketfrom
richard/add-ssh

Conversation

@richard-ash
Copy link
Copy Markdown
Collaborator

No description provided.

@richard-ash richard-ash marked this pull request as ready for review March 19, 2026 21:16
@richard-ash richard-ash force-pushed the richard/add-ssh branch 3 times, most recently from 1f89cfb to 0fe9f1f Compare March 21, 2026 21:28
@richard-ash richard-ash force-pushed the richard/add-ssh branch 8 times, most recently from 99e376d to 8798c67 Compare April 2, 2026 22:22
@richard-ash richard-ash force-pushed the richard/add-ssh branch 3 times, most recently from ab429b1 to 089dd44 Compare April 3, 2026 21:16
@richard-ash richard-ash force-pushed the richard/refactor-http-websocket branch from 48b96e7 to 65e2e94 Compare April 4, 2026 19:19
@richard-ash richard-ash force-pushed the richard/add-ssh branch 2 times, most recently from eb5647e to 9f345f8 Compare April 6, 2026 20:26
@richard-ash richard-ash force-pushed the richard/add-ssh branch 3 times, most recently from a7c2b93 to 146a4c4 Compare April 7, 2026 19:03
@richard-ash richard-ash force-pushed the richard/refactor-http-websocket branch from 65e2e94 to 9be9f90 Compare April 7, 2026 19:15
@richard-ash richard-ash force-pushed the richard/add-ssh branch 3 times, most recently from cc36c29 to 78b31c6 Compare April 7, 2026 19:58
@richard-ash richard-ash force-pushed the richard/add-ssh branch 15 times, most recently from 4a75c43 to 6831175 Compare April 9, 2026 00:45
Comment on lines +22 to +37
def handle_ssh_msg({:ssh_cm, connection, inner}, state) do
acknowledge(connection, inner)

case maybe_dispatch(state, inner) do
{:ok, :ignore} ->
{:ok, state}

{:ok, reply} ->
send_reply(connection, state, reply)
finish(connection, inner, reply_opts(reply), state)

{:error, reason} ->
handle_dispatch_error(connection, state, inner, reason)
finish(connection, inner, [exit_status: 1], state)
end
end
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It should dispatch before anything else because also the reply must be modifiable (you want to be able to control all messages):

Suggested change
def handle_ssh_msg({:ssh_cm, connection, inner}, state) do
acknowledge(connection, inner)
case maybe_dispatch(state, inner) do
{:ok, :ignore} ->
{:ok, state}
{:ok, reply} ->
send_reply(connection, state, reply)
finish(connection, inner, reply_opts(reply), state)
{:error, reason} ->
handle_dispatch_error(connection, state, inner, reason)
finish(connection, inner, [exit_status: 1], state)
end
end
def handle_ssh_msg({:ssh_cm, connection, frame}, state) do
case dispatch(state, frame) do
{:ok, :ignore} ->
{:ok, state}
{:ok, res} ->
send_resp(res)
{:error, reason} ->
handle_error(reason)
end
end

Co-Authored-By: Dan Schultzer <1254724+danschultzer@users.noreply.github.com>
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