MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ on_connection_error()

void MayaFlux::Core::TCPBackend::on_connection_error ( ConnectionState &  conn,
const asio::error_code &  ec 
)
private

Handle a connection error (read/write failure).

Transitions to ERROR. If auto_reconnect and outbound, schedules reconnect via steady_timer.

Definition at line 541 of file TCPBackend.cpp.

542{
543 if (ec == asio::error::operation_aborted) {
544 return;
545 }
546
547 if (ec == asio::error::eof) {
549 "TCP endpoint {} peer disconnected", conn.info.id);
550 } else {
552 "TCP endpoint {} error: {}", conn.info.id, ec.message());
553 }
554
555 asio::error_code close_ec;
556 if (!conn.socket.close(close_ec)) {
558 "Error closing TCP socket for endpoint {}: {}", conn.info.id, close_ec.message());
559 }
560
561 if (conn.is_outbound && m_config.auto_reconnect) {
563 schedule_reconnect(conn);
564 } else {
566 }
567}
#define MF_INFO(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
void transition_state(EndpointInfo &info, EndpointState new_state)
void schedule_reconnect(ConnectionState &conn)
Schedule a reconnect attempt after the configured interval.
@ NetworkBackend
Network transport backend (UDP, TCP, SHM)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Core::EndpointInfo::id, MayaFlux::Core::TCPBackend::ConnectionState::info, MayaFlux::Core::TCPBackend::ConnectionState::is_outbound, MF_INFO, MF_WARN, MayaFlux::Journal::NetworkBackend, and MayaFlux::Core::TCPBackend::ConnectionState::socket.