ExTermbox.PortHandler.InitHandler (ExTermbox v1.1.0)

View Source

Handles the initialization logic (init/1 callback and related messages) for ExTermbox.PortHandler.

Summary

Functions

Handles a timeout during the initialization phase. Replies error to the original start_link caller and prepares state for stop.

Handles incoming data packets received via the Port during the initial phase. It buffers data and attempts to parse the 'OK <socket_path>' line. Once the path is found, it initiates the UDS connection attempt.

The main entry point for PortHandler initialization. Finds the C helper, spawns the Port, sends the initial trigger, and returns the initial state or stop reason.

Functions

do_connect_socket(socket_path_charlist, remaining_buffer, state)

handle_init_timeout(type, pending_call, state)

Handles a timeout during the initialization phase. Replies error to the original start_link caller and prepares state for stop.

handle_port_data_init(packet, state)

Handles incoming data packets received via the Port during the initial phase. It buffers data and attempts to parse the 'OK <socket_path>' line. Once the path is found, it initiates the UDS connection attempt.

Returns:

  • {:noreply, state_updates_map, timeout | nil}: If more data is needed or connection started.

  • {:stop, reason, state_updates_map}: If parsing fails or connection initiation fails.

init_stage_connected()

init_stage_connecting_socket()

init_stage_init_failed()

init_stage_waiting_port_data()

internal_init_timeout()

start_port_and_init(opts)

The main entry point for PortHandler initialization. Finds the C helper, spawns the Port, sends the initial trigger, and returns the initial state or stop reason.