diff --git a/librepomgr/buildactions/buildactionlivestreaming.cpp b/librepomgr/buildactions/buildactionlivestreaming.cpp index 7d37f0d..0a237c1 100644 --- a/librepomgr/buildactions/buildactionlivestreaming.cpp +++ b/librepomgr/buildactions/buildactionlivestreaming.cpp @@ -113,7 +113,7 @@ void BuildProcessSession::registerWebSession(std::shared_ptr && void BuildProcessSession::registerNewDataHandler(std::function &&handler) { std::unique_lock lock(m_mutex); - m_newDataHandler = std::move(handler); + m_newDataHandlers.emplace_back(std::move(handler)); } void BuildProcessSession::prpareLogFile() @@ -176,8 +176,10 @@ void BuildProcessSession::writeDataFromPipe(boost::system::error_code ec, std::s sessionInfo->outstandingBuffersToSend.emplace_back(std::pair(m_buffer, bytesTransferred)); } } - if (m_newDataHandler) { - m_newDataHandler(m_buffer, bytesTransferred); + for (const auto &handler : m_newDataHandlers) { + if (handler) { + handler(m_buffer, bytesTransferred); + } } } // continue reading from the pipe unless there was an error diff --git a/librepomgr/buildactions/buildactionprivate.h b/librepomgr/buildactions/buildactionprivate.h index bc8ac46..9a116cd 100644 --- a/librepomgr/buildactions/buildactionprivate.h +++ b/librepomgr/buildactions/buildactionprivate.h @@ -186,7 +186,7 @@ private: std::mutex m_mutex; BuffersToWrite m_logFileBuffers; std::unordered_map, std::unique_ptr> m_registeredWebSessions; - std::function m_newDataHandler; + std::vector> m_newDataHandlers; AssociatedLocks m_locks; std::atomic_bool m_exited = false; };