mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 06:17:28 +02:00
Move PACKET_WRITE_ERROR to Packet class
This commit is contained in:
parent
12d5ec89d1
commit
2d86e807b0
2 changed files with 4 additions and 1 deletions
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include "Packet.h"
|
#include "Packet.h"
|
||||||
|
|
||||||
|
const qint64 Packet::PACKET_WRITE_ERROR = -1;
|
||||||
|
|
||||||
qint64 Packet::localHeaderSize(PacketType::Value type) {
|
qint64 Packet::localHeaderSize(PacketType::Value type) {
|
||||||
qint64 size = numBytesForArithmeticCodedPacketType(type) + sizeof(PacketVersion) +
|
qint64 size = numBytesForArithmeticCodedPacketType(type) + sizeof(PacketVersion) +
|
||||||
((SEQUENCE_NUMBERED_PACKETS.contains(type)) ? sizeof(SequenceNumber) : 0);
|
((SEQUENCE_NUMBERED_PACKETS.contains(type)) ? sizeof(SequenceNumber) : 0);
|
||||||
|
@ -208,7 +210,6 @@ void Packet::writeSequenceNumber(SequenceNumber seqNum) {
|
||||||
&seqNum, sizeof(seqNum));
|
&seqNum, sizeof(seqNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const qint64 PACKET_WRITE_ERROR = -1;
|
|
||||||
qint64 Packet::writeData(const char* data, qint64 maxSize) {
|
qint64 Packet::writeData(const char* data, qint64 maxSize) {
|
||||||
|
|
||||||
// make sure we have the space required to write this block
|
// make sure we have the space required to write this block
|
||||||
|
|
|
@ -24,6 +24,8 @@ class Packet : public QIODevice {
|
||||||
public:
|
public:
|
||||||
using SequenceNumber = uint16_t;
|
using SequenceNumber = uint16_t;
|
||||||
|
|
||||||
|
static const qint64 PACKET_WRITE_ERROR;
|
||||||
|
|
||||||
static std::unique_ptr<Packet> create(PacketType::Value type, qint64 size = -1);
|
static std::unique_ptr<Packet> create(PacketType::Value type, qint64 size = -1);
|
||||||
static std::unique_ptr<Packet> fromReceivedPacket(std::unique_ptr<char> data, qint64 size, const HifiSockAddr& senderSockAddr);
|
static std::unique_ptr<Packet> fromReceivedPacket(std::unique_ptr<char> data, qint64 size, const HifiSockAddr& senderSockAddr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue