MayaFlux 0.4.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 537 of file TCPBackend.cpp.

538{
539 if (ec == asio::error::operation_aborted) {
540 return;
541 }
542
543 if (ec == asio::error::eof) {
545 "TCP endpoint {} peer disconnected", conn.info.id);
546 } else {
548 "TCP endpoint {} error: {}", conn.info.id, ec.message());
549 }
550
551 asio::error_code close_ec;
552 if (!conn.socket.close(close_ec)) {
554 "Error closing TCP socket for endpoint {}: {}", conn.info.id, close_ec.message());
555 }
556
557 if (conn.is_outbound && m_config.auto_reconnect) {
559 schedule_reconnect(conn);
560 } else {
562 }
563}
#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.