Commit 33248ce0 by guanghui.cui

报文发送给pos,pos返回信息有时候收不到,为了防止订单一直推送,临时返回104,并记录错误信息

parent bfdf8abd
...@@ -289,6 +289,12 @@ bool TCPClient::read(void *buf, size_t count) ...@@ -289,6 +289,12 @@ bool TCPClient::read(void *buf, size_t count)
if (readBytes == -1) if (readBytes == -1)
{ {
LOG(INFO) << "recv errno:" << errno;
if (11 == errno) {
strcpy((char*)buf,"{\"status_code\": 100, \"msg\": \"recv errno:11\"}");
LOG(INFO) << "receive timeout,return 100 to ods,otherwise,this order will repeatedly push";
return true;
}
m_bValid = false; m_bValid = false;
return false; return false;
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
INITIALIZE_EASYLOGGINGPP INITIALIZE_EASYLOGGINGPP
#define VERSION "1.0.6" //版本号 #define VERSION "1.0.6 beta 3" //版本号
std::string g_init_data; std::string g_init_data;
std::string g_init_data_ods_back; std::string g_init_data_ods_back;
...@@ -442,16 +442,19 @@ bool order_send_to_pos(IN std::string &order_json,IN std::string &ods_json,OUT s ...@@ -442,16 +442,19 @@ bool order_send_to_pos(IN std::string &order_json,IN std::string &ods_json,OUT s
//jsonTool.getOdsResponseData(tmpUtf8, order_json, responseData); //jsonTool.getOdsResponseData(tmpUtf8, order_json, responseData);
}else }else
{ {
LOG(INFO) << "receive data from pos failed";
rlt=false; rlt=false;
} }
}else }else
{ {
LOG(INFO) << "send data to pos failed";
rlt=false; rlt=false;
} }
pos.close(); pos.close();
}else }else
{ {
LOG(INFO) << "connect pos failed,pos_listen_port:" << pos_listen_port << " pos_ip:" << pos_ip;
rlt=false; rlt=false;
} }
jsonTool.getOdsResponseData(tmp, order_json,ods_json, back_json); jsonTool.getOdsResponseData(tmp, order_json,ods_json, back_json);
......
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