fixes for assert in Connection and ControlPacket create

This commit is contained in:
Stephen Birarda 2015-07-30 17:20:22 -07:00
parent 1724e3c632
commit 367fa7b07b
2 changed files with 3 additions and 3 deletions

View file

@ -76,7 +76,7 @@ void Connection::sendACK(bool wasCausedBySyncTimeout) {
auto currentTime = high_resolution_clock::now();
SequenceNumber nextACKNumber = nextACK();
Q_ASSERT_X(nextACKNumber < _lastSentACK, "Connection::sendACK", "Sending lower ACK, something is wrong");
Q_ASSERT_X(nextACKNumber >= _lastSentACK, "Connection::sendACK", "Sending lower ACK, something is wrong");
if (nextACKNumber == _lastSentACK) {
// We already sent this ACK, but check if we should re-send it.

View file

@ -46,12 +46,12 @@ std::unique_ptr<ControlPacket> ControlPacket::create(Type type, qint64 size) {
std::unique_ptr<ControlPacket> controlPacket;
if (size == -1) {
return ControlPacket::create(type);
return std::unique_ptr<ControlPacket>(new ControlPacket(type));
} else {
// Fail with invalid size
Q_ASSERT(size >= 0);
return ControlPacket::create(type, size);
return std::unique_ptr<ControlPacket>(new ControlPacket(type, size));
}
}