From e2e1a0f374aeffc933d0e5d295607197d6b74a4a Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 10 Oct 2016 10:10:24 +0200 Subject: Fix dabOutputTCP shutdown using accept() with timeout --- src/dabOutput/dabOutputTcp.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/dabOutput') 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)); + } } } -- cgit v1.2.3