void FrTaskManage::netAddTaskCallback(ArServerClient* client, ArNetPacket* pkt)
{
AcquireSRWLockExclusive(&m_srwlock);
taskArg req;
req.robotId = 0;//多台的时候改这里
char reqName[1024];
pkt->bufToStr(reqName, sizeof(reqName));
req.taskName = reqName;
ArLog::log(ArLog::Normal, "taskName = %s", req.taskName.c_str());
m_requestList.push_back(req);
ReleaseSRWLockExclusive(&m_srwlock);
}
void FrTaskManage::netTaskRequestListCallback(ArServerClient* client, ArNetPacket* pkt)
{//客户端会每100ms请求一次
AcquireSRWLockShared(&m_srwlock);
ArNetPacket sendPkt;
sendPkt.byteToBuf(m_requestList.size());
std::list<taskArg>::iterator iter = m_requestList.begin();
while(iter != m_requestList.end())
{
pkt->strToBuf(iter->taskName.c_str());
pkt->byteToBuf(1);
}
client->sendPacketTcp(&sendPkt);
ReleaseSRWLockShared(&m_srwlock);
}
慕村225694
相关分类