a little closer to proper tuning

This commit is contained in:
Matt Broadstone 2014-06-09 19:39:09 -04:00
parent 1510e1f6c6
commit 55da181788
2 changed files with 6 additions and 9 deletions

View File

@ -319,9 +319,10 @@ void ClientPrivate::tune(const Frame::Method &frame)
stream >> frame_max; stream >> frame_max;
stream >> heartbeat_delay; stream >> heartbeat_delay;
channelMax = qMax(channel_max, channelMax); if (!frameMax)
heartbeatDelay = qMax(heartbeat_delay, heartbeatDelay); frameMax = frame_max;
frameMax = qMax(frame_max, frameMax); channelMax = !channelMax ? channel_max : qMax(channel_max, channelMax);
heartbeatDelay = !heartbeatDelay ? heartbeat_delay: qMax(heartbeat_delay, heartbeatDelay);
qAmqpDebug(">> channel_max: %d", channelMax); qAmqpDebug(">> channel_max: %d", channelMax);
qAmqpDebug(">> frame_max: %d", frameMax); qAmqpDebug(">> frame_max: %d", frameMax);

View File

@ -71,20 +71,16 @@ void tst_QAMQPClient::autoReconnect()
void tst_QAMQPClient::tune() void tst_QAMQPClient::tune()
{ {
// NOTE: this is totally incomplete, but the framework is here to
// test it. currently, only channel_max matters since the default
// from rabbit is 0.
Client client; Client client;
client.setChannelMax(15); client.setChannelMax(15);
client.setFrameMax(1000); client.setFrameMax(5000);
client.setHeartbeatDelay(600); client.setHeartbeatDelay(600);
client.connectToHost(); client.connectToHost();
QVERIFY(waitForSignal(&client, SIGNAL(connected()))); QVERIFY(waitForSignal(&client, SIGNAL(connected())));
QCOMPARE((int)client.channelMax(), 15); QCOMPARE((int)client.channelMax(), 15);
QCOMPARE((int)client.heartbeatDelay(), 600); QCOMPARE((int)client.heartbeatDelay(), 600);
QCOMPARE((int)client.frameMax(), 131072); QCOMPARE((int)client.frameMax(), 5000);
client.disconnectFromHost(); client.disconnectFromHost();
QVERIFY(waitForSignal(&client, SIGNAL(disconnected()))); QVERIFY(waitForSignal(&client, SIGNAL(disconnected())));