* Author: Nicklas P Andersson
*/
-
+
#include "../StdAfx.h"
#include "AMCPProtocolStrategy.h"
void Parse(const std::wstring& message, ClientInfoPtr client)
{
CASPAR_LOG_COMMUNICATION(info) << L"Received message from " << client->address() << ": " << message << L"\\r\\n";
-
+
command_interpreter_result result;
if(interpret_command_string(message, result, client))
{
else
result.queue->AddCommand(result.command);
}
-
+
if (result.error != error_state::no_error)
{
std::wstringstream answer;
if (!tokens.empty() && tokens.front().at(0) == L'/')
tokens.pop_front();
+ std::wstring request_id;
+
+ if (boost::iequals(tokens.front(), L"REQ"))
+ {
+ tokens.pop_front();
+
+ if (tokens.empty())
+ {
+ result.error = error_state::parameters_error;
+ return false;
+ }
+
+ request_id = tokens.front();
+ tokens.pop_front();
+ }
+
// Fail if no more tokens.
if (tokens.empty())
{
if (result.command->parameters().size() < result.command->minimum_parameters())
result.error = error_state::parameters_error;
}
+
+ if (result.command)
+ result.command->set_request_id(std::move(request_id));
}
catch (std::out_of_range&)
{