diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-11-08 09:50:37 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2024-11-08 09:50:37 +0100 |
commit | 3f382a56da220fbd39fdeb9ce4212629036686cb (patch) | |
tree | 0651faa1336f7e2a6d5631f335d853445bbe74cd /contrib/edioutput | |
parent | 03156cc8055f3ef083681414b635d9eca7b0f772 (diff) | |
download | ODR-AudioEnc-3f382a56da220fbd39fdeb9ce4212629036686cb.tar.gz ODR-AudioEnc-3f382a56da220fbd39fdeb9ce4212629036686cb.tar.bz2 ODR-AudioEnc-3f382a56da220fbd39fdeb9ce4212629036686cb.zip |
Add logging for TCP sender
Diffstat (limited to 'contrib/edioutput')
-rw-r--r-- | contrib/edioutput/Transport.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/edioutput/Transport.cpp b/contrib/edioutput/Transport.cpp index 8ebb9fc..cbff6d4 100644 --- a/contrib/edioutput/Transport.cpp +++ b/contrib/edioutput/Transport.cpp @@ -193,7 +193,15 @@ void Sender::write(const AFPacket& af_packet) tcp_dispatchers.at(tcp_dest.get())->write(af_packet); } else if (auto tcp_dest = dynamic_pointer_cast<edi::tcp_client_t>(dest)) { - tcp_senders.at(tcp_dest.get())->sendall(af_packet); + const auto error_stats = tcp_senders.at(tcp_dest.get())->sendall(af_packet); + + if (error_stats.has_seen_new_errors) { + fprintf(stderr, "TCP output %s:%d has %zu reconnects: most recent error: %s\n", + tcp_dest->dest_addr.c_str(), + tcp_dest->dest_port, + error_stats.num_reconnects, + error_stats.last_error.c_str()); + } } else { throw logic_error("EDI destination not implemented"); |