]> git.sesse.net Git - casparcg/commitdiff
#568 Fixed bug where not all error responses was preprended with RES [requestId]
authorHelge Norberg <helge.norberg@svt.se>
Mon, 6 Mar 2017 10:41:16 +0000 (11:41 +0100)
committerHelge Norberg <helge.norberg@svt.se>
Mon, 6 Mar 2017 10:41:16 +0000 (11:41 +0100)
protocol/amcp/AMCPProtocolStrategy.cpp

index 6009b3e930c73199656270718f288ac327ed0ee2..4b7907c3d3c15c10e27e68d5d100b8c9a8930ee5 100644 (file)
@@ -95,6 +95,7 @@ public:
        struct command_interpreter_result
        {
                std::shared_ptr<caspar::IO::lock_container>     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&)
                {