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.
- HWND
Wrapper π - Hacky wrapper around a window handle.
EnumsΒ§
- Control
Mode πState - Enum of all possible control mode states.
- Pipe
Server πState - 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_adjustmentdaemon 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
clientconsole 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
daemonsubcommand. - 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 + corCtrl + BREAKreceive special handling or are treated as simple key presses.