From: Helge Norberg Date: Mon, 6 Mar 2017 10:41:16 +0000 (+0100) Subject: #568 Fixed bug where not all error responses was preprended with RES [requestId] X-Git-Tag: 2.1.0_Beta2~64 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=91d1217ae51579f9a2cd298d4395ae49bbe911d3;p=casparcg #568 Fixed bug where not all error responses was preprended with RES [requestId] --- diff --git a/protocol/amcp/AMCPProtocolStrategy.cpp b/protocol/amcp/AMCPProtocolStrategy.cpp index 6009b3e93..4b7907c3d 100644 --- a/protocol/amcp/AMCPProtocolStrategy.cpp +++ b/protocol/amcp/AMCPProtocolStrategy.cpp @@ -95,6 +95,7 @@ public: struct command_interpreter_result { std::shared_ptr lock; + std::wstring request_id; std::wstring command_name; AMCPCommand::ptr_type command; error_state error = error_state::no_error; @@ -120,6 +121,9 @@ public: { std::wstringstream answer; + if (!result.request_id.empty()) + answer << L"RES " << result.request_id << L" "; + switch(result.error) { case error_state::command_error: @@ -157,8 +161,6 @@ private: if (!tokens.empty() && tokens.front().at(0) == L'/') tokens.pop_front(); - std::wstring request_id; - if (!tokens.empty() && boost::iequals(tokens.front(), L"REQ")) { tokens.pop_front(); @@ -169,7 +171,7 @@ private: return false; } - request_id = tokens.front(); + result.request_id = tokens.front(); tokens.pop_front(); } @@ -252,7 +254,7 @@ private: } if (result.command) - result.command->set_request_id(std::move(request_id)); + result.command->set_request_id(result.request_id); } catch (std::out_of_range&) {