Esempio n. 1
0
qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const Node& destinationNode) {
    qint64 bytesSent = 0;
    
    // close the last packet in the list
    packetList.closeCurrentPacket();
    
    while (!packetList._packets.empty()) {
        bytesSent += sendPacket(packetList.takeFront<NLPacket>(), destinationNode);
    }
    
    return bytesSent;
}
Esempio n. 2
0
qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr,
                                       const QUuid& connectionSecret) {
    qint64 bytesSent = 0;
    
    // close the last packet in the list
    packetList.closeCurrentPacket();
    
    while (!packetList._packets.empty()) {
        bytesSent += sendPacket(packetList.takeFront<NLPacket>(), sockAddr, connectionSecret);
    }
    
    return bytesSent;
}
Esempio n. 3
0
ReceivedMessage::ReceivedMessage(const NLPacketList& packetList)
    : _data(packetList.getMessage()),
      _headData(_data.mid(0, HEAD_DATA_SIZE)),
      _numPackets(packetList.getNumPackets()),
      _sourceID(packetList.getSourceID()),
      _packetType(packetList.getType()),
      _packetVersion(packetList.getVersion()),
      _senderSockAddr(packetList.getSenderSockAddr())
{
}
Esempio n. 4
0
qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const Node& destinationNode) {
    auto activeSocket = destinationNode.getActiveSocket();
    if (!activeSocket) {
        return 0;
    }
    qint64 bytesSent = 0;
    auto connectionSecret = destinationNode.getConnectionSecret();
    
    // close the last packet in the list
    packetList.closeCurrentPacket();
    
    while (!packetList._packets.empty()) {
        bytesSent += sendPacket(packetList.takeFront<NLPacket>(), *activeSocket, connectionSecret);
    }
    
    emit dataSent(destinationNode.getType(), bytesSent);
    return bytesSent;
}
Esempio n. 5
0
qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const Node& destinationNode) {
    auto activeSocket = destinationNode.getActiveSocket();
    
    if (activeSocket) {
        qint64 bytesSent = 0;
        auto connectionSecret = destinationNode.getConnectionSecret();
        
        // close the last packet in the list
        packetList.closeCurrentPacket();
        
        while (!packetList._packets.empty()) {
            bytesSent += sendPacket(packetList.takeFront<NLPacket>(), *activeSocket, connectionSecret);
        }
        
        emit dataSent(destinationNode.getType(), bytesSent);
        return bytesSent;
    } else {
        qDebug() << "LimitedNodeList::sendPacketList called without active socket for node" << destinationNode
            << " - not sending.";
        return 0;
    }
}