ExWapp.Session.Worker.Connection (ExWapp v0.1.2)

Copy Markdown View Source

The session's connection lifecycle: opening the transport, reacting to what it reports, tearing it down and deciding when to try again.

Everything here runs inside the session process — the worker calls these functions, so the transport is linked to it, Process.monitor/1 registers the monitor against it and timers fire back into its mailbox, exactly as when this code sat in ExWapp.Session.Worker. Nothing is moved to another process; only the code moved out of the module.

Teardown is deliberately tolerant: a disconnect cancels timers, drains pending callers and stops child processes, and each of those steps has to run even if an earlier one found nothing to clean up.

Summary

Functions

clear_initial_sync_task(state)

connection_event_summary(event)

do_connect(state)

do_disconnect(state, reason)

do_health_check(state)

ensure_connected_for_send(arg1)

fail_all_send_workers(state, reason)

handle_connection_event(event, state)

handle_connection_exit(state, reason)

reply_send_caller(from, result)

restart_connection_now(state, reason)

restart_inbound_router(state)

restart_outbound_queue(state)

schedule_connect(state, delay_ms)