diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-10-10 10:10:24 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-10-10 10:10:24 +0200 |
commit | e2e1a0f374aeffc933d0e5d295607197d6b74a4a (patch) | |
tree | 1878bc61a66d221d3e4395e10e1d72aa487fb36e /src/dabOutput | |
parent | eccfa8ad3774205a929ff70090540d24674618a1 (diff) | |
download | dabmux-e2e1a0f374aeffc933d0e5d295607197d6b74a4a.tar.gz dabmux-e2e1a0f374aeffc933d0e5d295607197d6b74a4a.tar.bz2 dabmux-e2e1a0f374aeffc933d0e5d295607197d6b74a4a.zip |
Fix dabOutputTCP shutdown using accept() with timeout
Diffstat (limited to 'src/dabOutput')
-rw-r--r-- | src/dabOutput/dabOutputTcp.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dabOutput/dabOutputTcp.cpp b/src/dabOutput/dabOutputTcp.cpp index 2c5a067..343ba0f 100644 --- a/src/dabOutput/dabOutputTcp.cpp +++ b/src/dabOutput/dabOutputTcp.cpp @@ -128,9 +128,14 @@ class TCPDataDispatcher void process(long) { m_listener_socket.listen(); + const int timeout_ms = 1000; + while (m_running) { // Add a new TCPConnection to the list, constructing it from the client socket - m_connections.emplace(m_connections.begin(), m_listener_socket.accept()); + auto optional_sock = m_listener_socket.accept(timeout_ms); + if (optional_sock) { + m_connections.emplace(m_connections.begin(), std::move(*optional_sock)); + } } } |