guarantee frames are written

wait for the END frame to be written, guaranteeing that data will
be written when you think it has been.
This commit is contained in:
Matt Broadstone 2014-07-28 11:36:52 -04:00
parent 5d00b2a068
commit fa132d7c72
3 changed files with 2 additions and 5 deletions

View File

@ -57,6 +57,7 @@ void Base::writeHeader(QDataStream &stream) const
void Base::writeEnd(QDataStream &stream) const void Base::writeEnd(QDataStream &stream) const
{ {
stream << qint8(FRAME_END); stream << qint8(FRAME_END);
stream.device()->waitForBytesWritten(1000);
} }
void Base::writePayload(QDataStream &stream) const void Base::writePayload(QDataStream &stream) const

View File

@ -112,6 +112,7 @@ void tst_QAMQPExchange::invalidRedeclaration()
// this is per spec: // this is per spec:
// QCOMPARE(redeclared->error(), QAMQP::NotAllowedError); // QCOMPARE(redeclared->error(), QAMQP::NotAllowedError);
// this is for rabbitmq: // this is for rabbitmq:
QCOMPARE(redeclared->error(), QAMQP::PreconditionFailedError); QCOMPARE(redeclared->error(), QAMQP::PreconditionFailedError);

View File

@ -367,9 +367,6 @@ void tst_QAMQPQueue::get()
defaultExchange->publish(expected, "test-get"); defaultExchange->publish(expected, "test-get");
} }
// wait for messages to be delivered
QTest::qWait(25);
for (int i = 0; i < messageCount; ++i) { for (int i = 0; i < messageCount; ++i) {
QString expected = QString("message %1").arg(i); QString expected = QString("message %1").arg(i);
queue->get(false); queue->get(false);
@ -448,8 +445,6 @@ void tst_QAMQPQueue::qos()
defaultExchange->publish(message, "test-qos"); defaultExchange->publish(message, "test-qos");
} }
QTest::qWait(100);
// begin consuming, one at a time // begin consuming, one at a time
QVERIFY(queue->consume()); QVERIFY(queue->consume());
QVERIFY(waitForSignal(queue, SIGNAL(consuming(QString)))); QVERIFY(waitForSignal(queue, SIGNAL(consuming(QString))));