Example #1
0
bool CProtocolComm::SendResponseFrame(DWORD dwRequestPacketID, Packet &packet)
{
    Packet packet_remain;
    if (WaitPopLast(0, packet_remain))
    {
        WARNING("sendResponseFrame queue get test");
        // 如果是之前请求包的重发,则立即返回结果,否则丢弃结果包
        if (packet_remain.GetPacketID() != dwRequestPacketID)
        {
            // 丢弃返回包
            WARNING("sendResponseFrame queue find diff id packet");
            // 重新放入队列,等待处理
            m_queue.Push(packet_remain);
            return false;
        }
    }

    return SendFrame(packet.GetSrcAddr(), packet.GetDestAddr(),
                     packet.GetType(), packet.GetFunction(),
                     packet.GetData(), packet.GetDataLen(), false);
}
Example #2
0
bool CProtocolComm::SendFrame(Packet &packet)
{
    return SendFrame(packet.GetSrcAddr(), packet.GetDestAddr(),
                     packet.GetType(), packet.GetFunction(),
                     packet.GetData(), packet.GetDataLen());
}