ExTermbox.InitHandler (ExTermbox v1.1.0)

View Source

Handles the initialization sequence within the PortHandler GenServer. This module encapsulates the logic for parsing port output, managing timeouts, and establishing the UDS connection.

Summary

Functions

Called by PortHandler via :continue after the UDS connect delay. Checks socket existence and attempts connection.

Called by PortHandler when it receives data from the port during initialization. Parses the data to find the socket path. Transitions PortHandler state to :connecting_socket or stops on error.

Called by PortHandler when the OS port exits during initialization. Replies error to the original caller and stops the PortHandler.

Called by PortHandler when the :gen_tcp socket connection fails. Replies error to the original caller and stops the PortHandler.

Called by PortHandler when the :gen_tcp socket connection succeeds. Replies :ok to the original caller and transitions PortHandler state.

Called by PortHandler on timeout during initialization stages. Replies error to the original caller and stops the PortHandler.

Functions

handle_continue_attempt_connect(socket_path, state)

Called by PortHandler via :continue after the UDS connect delay. Checks socket existence and attempts connection.

handle_port_data_init(packet, state)

Called by PortHandler when it receives data from the port during initialization. Parses the data to find the socket path. Transitions PortHandler state to :connecting_socket or stops on error.

handle_port_exit_init(status, state)

Called by PortHandler when the OS port exits during initialization. Replies error to the original caller and stops the PortHandler.

handle_socket_connect_failure(reason, socket_path, caller, state)

Called by PortHandler when the :gen_tcp socket connection fails. Replies error to the original caller and stops the PortHandler.

handle_socket_connect_success(socket, caller)

Called by PortHandler when the :gen_tcp socket connection succeeds. Replies :ok to the original caller and transitions PortHandler state.

handle_timeout_init(stage_atom, state)

Called by PortHandler on timeout during initialization stages. Replies error to the original caller and stops the PortHandler.