diff --git a/server/streamreader/stream_control.cpp b/server/streamreader/stream_control.cpp index 8186d6ad..525018b8 100644 --- a/server/streamreader/stream_control.cpp +++ b/server/streamreader/stream_control.cpp @@ -47,11 +47,6 @@ StreamControl::StreamControl(const boost::asio::any_io_executor& executor) : exe } -StreamControl::~StreamControl() -{ - stop(); -} - void StreamControl::start(const std::string& stream_id, const ServerSettings& server_setttings, const OnNotification& notification_handler, const OnRequest& request_handler, const OnLog& log_handler) @@ -78,10 +73,6 @@ void StreamControl::command(const jsonrpcpp::Request& request, const OnResponse& } -void StreamControl::stop() -{ -} - void StreamControl::onReceive(const std::string& json) { @@ -157,6 +148,7 @@ ScriptStreamControl::ScriptStreamControl(const boost::asio::any_io_executor& exe } + void ScriptStreamControl::doStart(const std::string& stream_id, const ServerSettings& server_setttings) { pipe_stderr_ = bp::pipe(); @@ -248,21 +240,4 @@ void ScriptStreamControl::stdoutReadLine() } - -void ScriptStreamControl::stop() -{ - if (process_.running()) - { - LOG(INFO, LOG_TAG) << "Stopping script '" << script_ << "'\n"; - ::kill(-process_.native_handle(), SIGINT); - auto timeout = 500ms; - if (!process_.wait_for(timeout)) - { - LOG(INFO, LOG_TAG) << "Script did not terminate after " << timeout.count() << " ms, terminating.\n"; - process_.terminate(); - } - } -} - - } // namespace streamreader diff --git a/server/streamreader/stream_control.hpp b/server/streamreader/stream_control.hpp index f2267e7f..d36617a2 100644 --- a/server/streamreader/stream_control.hpp +++ b/server/streamreader/stream_control.hpp @@ -59,11 +59,10 @@ public: using OnLog = std::function; StreamControl(const boost::asio::any_io_executor& executor); - virtual ~StreamControl(); + virtual ~StreamControl() = default; void start(const std::string& stream_id, const ServerSettings& server_setttings, const OnNotification& notification_handler, const OnRequest& request_handler, const OnLog& log_handler); - virtual void stop(); void command(const jsonrpcpp::Request& request, const OnResponse& response_handler); @@ -91,8 +90,6 @@ public: ScriptStreamControl(const boost::asio::any_io_executor& executor, const std::string& script, const std::string& params); virtual ~ScriptStreamControl() = default; - void stop() override; - protected: /// Send a message to stdin of the process void doCommand(const jsonrpcpp::Request& request) override;