refactor(channels): move resetInternalState to private impls
This commit is contained in:
parent
3781006a1e
commit
f6777e66df
|
|
@ -92,6 +92,12 @@ void QAmqpChannelPrivate::sendFrame(const QAmqpFrame &frame)
|
|||
client->d_func()->sendFrame(frame);
|
||||
}
|
||||
|
||||
void QAmqpChannelPrivate::resetInternalState()
|
||||
{
|
||||
opened = false;
|
||||
needOpen = true;
|
||||
}
|
||||
|
||||
void QAmqpChannelPrivate::open()
|
||||
{
|
||||
if (!needOpen || opened)
|
||||
|
|
@ -348,11 +354,4 @@ void QAmqpChannel::resume()
|
|||
d->flow(true);
|
||||
}
|
||||
|
||||
void QAmqpChannel::resetInternalState()
|
||||
{
|
||||
Q_D(QAmqpChannel);
|
||||
d->opened = false;
|
||||
d->needOpen = true;
|
||||
}
|
||||
|
||||
#include "moc_qamqpchannel.cpp"
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ Q_SIGNALS:
|
|||
protected:
|
||||
virtual void channelOpened() = 0;
|
||||
virtual void channelClosed() = 0;
|
||||
virtual void resetInternalState();
|
||||
|
||||
protected:
|
||||
explicit QAmqpChannel(QAmqpChannelPrivate *dd, QAmqpClient *client);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
|
||||
void init(int channel, QAmqpClient *client);
|
||||
void sendFrame(const QAmqpFrame &frame);
|
||||
virtual void resetInternalState();
|
||||
|
||||
void open();
|
||||
void flow(bool active);
|
||||
|
|
|
|||
|
|
@ -73,15 +73,13 @@ void QAmqpClientPrivate::resetChannelState()
|
|||
foreach (QString exchangeName, exchanges.channels()) {
|
||||
QAmqpExchange *exchange =
|
||||
qobject_cast<QAmqpExchange*>(exchanges.get(exchangeName));
|
||||
if (exchange) exchange->resetInternalState();
|
||||
else qDebug() << "INVALID EXCHANGE: " << exchangeName;
|
||||
if (exchange) exchange->d_ptr->resetInternalState();
|
||||
}
|
||||
|
||||
foreach (QString queueName, queues.channels()) {
|
||||
QAmqpQueue *queue =
|
||||
qobject_cast<QAmqpQueue*>(queues.get(queueName));
|
||||
if (queue) queue->resetInternalState();
|
||||
else qDebug() << "INVALID QUEUE: " << queueName;
|
||||
if (queue) queue->d_ptr->resetInternalState();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,14 @@ QAmqpExchangePrivate::QAmqpExchangePrivate(QAmqpExchange *q)
|
|||
{
|
||||
}
|
||||
|
||||
void QAmqpExchangePrivate::resetInternalState()
|
||||
{
|
||||
QAmqpChannelPrivate::resetInternalState();
|
||||
delayedDeclare = false;
|
||||
declared = false;
|
||||
nextDeliveryTag = 0;
|
||||
}
|
||||
|
||||
void QAmqpExchangePrivate::declare()
|
||||
{
|
||||
if (!opened) {
|
||||
|
|
@ -351,13 +359,3 @@ bool QAmqpExchange::waitForConfirms(int msecs)
|
|||
|
||||
return (d->unconfirmedDeliveryTags.isEmpty());
|
||||
}
|
||||
|
||||
void QAmqpExchange::resetInternalState()
|
||||
{
|
||||
Q_D(QAmqpExchange);
|
||||
QAmqpChannel::resetInternalState();
|
||||
|
||||
d->delayedDeclare = false;
|
||||
d->declared = false;
|
||||
d->nextDeliveryTag = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ public Q_SLOTS:
|
|||
protected:
|
||||
virtual void channelOpened();
|
||||
virtual void channelClosed();
|
||||
virtual void resetInternalState();
|
||||
|
||||
private:
|
||||
explicit QAmqpExchange(int channelNumber = -1, QAmqpClient *parent = 0);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ public:
|
|||
QAmqpExchangePrivate(QAmqpExchange *q);
|
||||
static QString typeToString(QAmqpExchange::ExchangeType type);
|
||||
|
||||
virtual void resetInternalState();
|
||||
|
||||
void declare();
|
||||
|
||||
// method handler related
|
||||
|
|
|
|||
|
|
@ -31,6 +31,17 @@ QAmqpQueuePrivate::~QAmqpQueuePrivate()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void QAmqpQueuePrivate::resetInternalState()
|
||||
{
|
||||
QAmqpChannelPrivate::resetInternalState();
|
||||
delayedDeclare = false;
|
||||
declared = false;
|
||||
recievingMessage = false;
|
||||
consuming = false;
|
||||
consumeRequested = false;
|
||||
}
|
||||
|
||||
bool QAmqpQueuePrivate::_q_method(const QAmqpMethodFrame &frame)
|
||||
{
|
||||
Q_Q(QAmqpQueue);
|
||||
|
|
@ -603,16 +614,4 @@ bool QAmqpQueue::cancel(bool noWait)
|
|||
return true;
|
||||
}
|
||||
|
||||
void QAmqpQueue::resetInternalState()
|
||||
{
|
||||
Q_D(QAmqpQueue);
|
||||
QAmqpChannel::resetInternalState();
|
||||
|
||||
d->delayedDeclare = false;
|
||||
d->declared = false;
|
||||
d->recievingMessage = false;
|
||||
d->consuming = false;
|
||||
d->consumeRequested = false;
|
||||
}
|
||||
|
||||
#include "moc_qamqpqueue.cpp"
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ protected:
|
|||
// reimp Channel
|
||||
virtual void channelOpened();
|
||||
virtual void channelClosed();
|
||||
virtual void resetInternalState();
|
||||
|
||||
private:
|
||||
explicit QAmqpQueue(int channelNumber = -1, QAmqpClient *parent = 0);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ public:
|
|||
QAmqpQueuePrivate(QAmqpQueue *q);
|
||||
~QAmqpQueuePrivate();
|
||||
|
||||
virtual void resetInternalState();
|
||||
|
||||
void declare();
|
||||
virtual bool _q_method(const QAmqpMethodFrame &frame);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue