summaryrefslogtreecommitdiffstats
path: root/src/dabOutput
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-10-30 12:18:14 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-10-30 12:18:14 +0100
commit7512c84d0cd7d9b1a3733e84280864f5a989b51e (patch)
tree4f1b078e3ebad93b02f888796d07cf574aaafa5b /src/dabOutput
parent5aa8118d99b104402bf044e57c473a7156dc2314 (diff)
downloaddabmux-7512c84d0cd7d9b1a3733e84280864f5a989b51e.tar.gz
dabmux-7512c84d0cd7d9b1a3733e84280864f5a989b51e.tar.bz2
dabmux-7512c84d0cd7d9b1a3733e84280864f5a989b51e.zip
Catch runtime_error in TCPDataDispatcher thread
Diffstat (limited to 'src/dabOutput')
-rw-r--r--src/dabOutput/dabOutputTcp.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/dabOutput/dabOutputTcp.cpp b/src/dabOutput/dabOutputTcp.cpp
index 8696bec..6485d15 100644
--- a/src/dabOutput/dabOutputTcp.cpp
+++ b/src/dabOutput/dabOutputTcp.cpp
@@ -126,17 +126,23 @@ class TCPDataDispatcher
private:
void process(long) {
- m_listener_socket.listen();
+ try {
+ m_listener_socket.listen();
- const int timeout_ms = 1000;
+ const int timeout_ms = 1000;
- while (m_running) {
- // Add a new TCPConnection to the list, constructing it from the client socket
- auto optional_sock = m_listener_socket.accept(timeout_ms);
- if (optional_sock) {
- m_connections.emplace(m_connections.begin(), std::move(*optional_sock));
+ while (m_running) {
+ // Add a new TCPConnection to the list, constructing it from the client socket
+ auto optional_sock = m_listener_socket.accept(timeout_ms);
+ if (optional_sock) {
+ m_connections.emplace(m_connections.begin(), std::move(*optional_sock));
+ }
}
}
+ catch (std::runtime_error& e) {
+ etiLog.level(error) << "TCPDataDispatcher caught runtime error: " << e.what();
+ m_running = false;
+ }
}
atomic<bool> m_running;