Module daemon

Module daemon 

Expand description

Daemon imlementation

ModulesΒ§

workspace πŸ”’

StructsΒ§

Client πŸ”’
Representation of a client
Clients πŸ”’
Collection of Clients maintaining insertion order and a PID-indexed lookup table.
Daemon πŸ”’
The daemon is responsible to launch a client for each host, positioning the client windows, forwarding input records to all clients and handling control mode.
HWNDWrapper πŸ”’
Hacky wrapper around a window handle.

EnumsΒ§

ControlModeState πŸ”’
Enum of all possible control mode states.
PipeServerState πŸ”’
Runtime state of a client’s assigned pipe server task.

ConstantsΒ§

SENDER_CAPACITY πŸ”’
The capacity of the broadcast channel used to send the input records read from the console input buffer to the named pipe servers connected to each client in parallel.

FunctionsΒ§

arrange_client_window πŸ”’
Re-sizes and re-positions the given client window based on the total number of clients, the size of the daemon console window and its index relative to the other client windows.
defer_windows πŸ”’
Move all given windows to the foreground.
determine_client_spatial_attributes πŸ”’
Calculates the position and dimensions for a client window given its index, the total number of clients and the aspect_ratio_adjustment daemon configuration.
ensure_client_z_order_in_sync_with_daemon πŸ”’
Spawns a background thread that ensures the z-order of all client windows is in sync with the daemon window. I.e. if the daemon window is focussed, all clients should be moved to the foreground.
get_console_rect πŸ”’
Transform the position and dimensions of a console window based on the workspace area.
get_console_window_wrapper πŸ”’
Returns a window handle to the current console window.
get_foreground_window_wrapper πŸ”’
Returns a window handle to the foreground window.
launch_client_console πŸ”’
Launchs a client console process with its own window with the given CLI arguments/options: host, username, port, debug.
launch_clients πŸ”’
Launches a client console for each given host and waits for the client windows to exist before returning their handles.
main
The entrypoint for the daemon subcommand.
named_pipe_server_routine πŸ”’
Wait for the named pipe server to connect, correlate the client by its process id, then forward serialized input records read from the broadcast channel to the named pipe server.
read_client_pid πŸ”’
Read the connecting client’s 4 byte little-endian process id from the pipe.
resolve_cluster_tags
Resolve cluster tags into hostnames
toggle_processed_input_mode πŸ”’
The processed console input mode controls whether special key combinations such as Ctrl + c or Ctrl + BREAK receive special handling or are treated as simple key presses.