Commit 3cb8c8f5 by 李维杰

修复请求bug

parent 40cf7643
......@@ -63,28 +63,26 @@ namespace offcn
return;
}
ReqValue valuse;
if (method.compare("join") == 0)
{
if (MqttRequest::ParseJoinRequest(message, valuse, error))
if (MqttRequest::ParseJoinRequest(message, values, error))
{
OnParseJoinSuccess(values["message_id"], valuse["from_id"]);
OnParseJoinSuccess(values["message_id"], values["from_id"]);
}
else
{
OnParseFailure(values["message_id"], valuse["from_id"], error);
OnParseFailure(values["message_id"], values["from_id"], error);
}
}
else if (method.compare("update") == 0)
{
if (MqttRequest::ParseUpdateRequest(message, valuse, error))
if (MqttRequest::ParseUpdateRequest(message, values, error))
{
OnParseUpdateSuccess(valuse["message_id"], values["from_id"], values["pull_type"]);
OnParseUpdateSuccess(values["message_id"], values["from_id"], values["pull_type"]);
}
else
{
OnParseFailure(valuse["message_id"], values["from_id"], error);
OnParseFailure(values["message_id"], values["from_id"], error);
}
}
}
......@@ -103,6 +101,7 @@ namespace offcn
{
client_lists_.insert(std::pair<std::string, std::string>(from_id, "null"));
response = MqttRequest::BuildResponse(message_id, "ok");
mqtt_wrapper_->SendRequest(from_id, response);
printf("\n------------------------------------\n");
std::map<std::string, std::string>::iterator itor;
......
......@@ -11,7 +11,7 @@ namespace offcn
static std::string clientMessageID()
{
char str[12] = { 0 };
char str[256] = { 0 };
int len = 12;
srand((unsigned int)time(NULL));
......@@ -116,6 +116,11 @@ namespace offcn
return;
}
if (method.compare("result_code"))
{
return;
}
if (method.compare("publishers") == 0)
{
if (MqttRequest::ParsePublishersRequest(message, values, error))
......
......@@ -89,12 +89,14 @@ namespace offcn
return false;
}
if (!root["method"])
if (!root["method"] && !root["result_code"])
{
error = "param error";
return false;
}
type = root["method"].asString();
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment