aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-12-30 11:47:30 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-12-30 11:47:30 +0100
commita4491c33173b3d68080f7c58742039ef026fec2f (patch)
treebe5a8d633488981d852d8814b770dc24ac2f31c1
parent6b74acca07a052072bff080e16a2eba3c701e726 (diff)
downloadODR-EDI2EDI-a4491c33173b3d68080f7c58742039ef026fec2f.tar.gz
ODR-EDI2EDI-a4491c33173b3d68080f7c58742039ef026fec2f.tar.bz2
ODR-EDI2EDI-a4491c33173b3d68080f7c58742039ef026fec2f.zip
Disable output inhibit, that should now be handled in the edisender
-rw-r--r--src/EDISender.cpp6
-rw-r--r--src/EDISender.h2
-rw-r--r--src/main.cpp11
-rw-r--r--src/main.h2
4 files changed, 10 insertions, 11 deletions
diff --git a/src/EDISender.cpp b/src/EDISender.cpp
index 9783617..435a8d8 100644
--- a/src/EDISender.cpp
+++ b/src/EDISender.cpp
@@ -65,6 +65,7 @@ void EDISender::update_settings(const EDISenderSettings& settings)
void EDISender::push_tagpacket(tagpacket_t&& tp)
{
+#warning "TODO handle inhibit"
std::unique_lock<std::mutex> lock(_pending_tagpackets_mutex);
bool inserted = false;
for (auto it = _pending_tagpackets.begin(); it != _pending_tagpackets.end(); ++it) {
@@ -108,11 +109,6 @@ void EDISender::print_configuration()
}
}
-void EDISender::inhibit_until(std::chrono::steady_clock::time_point tp)
-{
- _output_inhibit_until = tp;
-}
-
void EDISender::send_tagpacket(tagpacket_t& tp)
{
// Wait until our time is tist_delay after the TIST before
diff --git a/src/EDISender.h b/src/EDISender.h
index 9822b24..a2c7a25 100644
--- a/src/EDISender.h
+++ b/src/EDISender.h
@@ -73,8 +73,6 @@ class EDISender {
void push_tagpacket(tagpacket_t&& tagpacket);
void print_configuration(void);
- void inhibit_until(std::chrono::steady_clock::time_point tp);
-
private:
void send_tagpacket(tagpacket_t& frame);
void process(void);
diff --git a/src/main.cpp b/src/main.cpp
index db3292a..3160b2e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -120,8 +120,11 @@ void Receiver::tick()
// source.enabled gets modified by RC
if (source.enabled) {
if (not sock.valid()) {
- etiLog.level(info) << "Reconnecting to TCP " << source.hostname << ":" << source.port;
- sock.connect(source.hostname, source.port, /*nonblock*/ true);
+ if (reconnect_at < chrono::steady_clock::now()) {
+ etiLog.level(info) << "Reconnecting to TCP " << source.hostname << ":" << source.port;
+ sock.connect(source.hostname, source.port, /*nonblock*/ true);
+ reconnect_at += chrono::seconds(2);
+ }
}
}
else {
@@ -159,8 +162,8 @@ void Receiver::receive()
if (not success) {
sock.close();
- etiLog.level(info) << "Source disconnected, reconnecting and enabling output inhibit backoff";
- edi_sender.inhibit_until(chrono::steady_clock::now() + backoff);
+ etiLog.level(info) << "Source disconnected, reconnecting in 2s";
+ reconnect_at = chrono::steady_clock::now() + chrono::seconds(2);
}
}
diff --git a/src/main.h b/src/main.h
index 1465cd1..1d80956 100644
--- a/src/main.h
+++ b/src/main.h
@@ -83,6 +83,8 @@ class Receiver : public EdiDecoder::ETIDataCollector {
EdiDecoder::ETIDecoder edi_decoder;
uint16_t dlfc = 0;
+ std::chrono::steady_clock::time_point reconnect_at = std::chrono::steady_clock::now();
+
Socket::TCPSocket sock;
};