diff --git a/src/qamqpchannel.cpp b/src/qamqpchannel.cpp index 4e10cbb..6b39f74 100644 --- a/src/qamqpchannel.cpp +++ b/src/qamqpchannel.cpp @@ -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" diff --git a/src/qamqpchannel.h b/src/qamqpchannel.h index f706b31..2e29b37 100644 --- a/src/qamqpchannel.h +++ b/src/qamqpchannel.h @@ -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); diff --git a/src/qamqpchannel_p.h b/src/qamqpchannel_p.h index a84e19b..8bb9679 100644 --- a/src/qamqpchannel_p.h +++ b/src/qamqpchannel_p.h @@ -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); diff --git a/src/qamqpclient.cpp b/src/qamqpclient.cpp index ae2f311..da97f43 100644 --- a/src/qamqpclient.cpp +++ b/src/qamqpclient.cpp @@ -73,15 +73,13 @@ void QAmqpClientPrivate::resetChannelState() foreach (QString exchangeName, exchanges.channels()) { QAmqpExchange *exchange = qobject_cast(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(queues.get(queueName)); - if (queue) queue->resetInternalState(); - else qDebug() << "INVALID QUEUE: " << queueName; + if (queue) queue->d_ptr->resetInternalState(); } } diff --git a/src/qamqpexchange.cpp b/src/qamqpexchange.cpp index 59c5a22..41aef68 100644 --- a/src/qamqpexchange.cpp +++ b/src/qamqpexchange.cpp @@ -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; -} diff --git a/src/qamqpexchange.h b/src/qamqpexchange.h index 6de3846..da16aff 100644 --- a/src/qamqpexchange.h +++ b/src/qamqpexchange.h @@ -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); diff --git a/src/qamqpexchange_p.h b/src/qamqpexchange_p.h index 3083344..cb6ccbb 100644 --- a/src/qamqpexchange_p.h +++ b/src/qamqpexchange_p.h @@ -20,6 +20,8 @@ public: QAmqpExchangePrivate(QAmqpExchange *q); static QString typeToString(QAmqpExchange::ExchangeType type); + virtual void resetInternalState(); + void declare(); // method handler related diff --git a/src/qamqpqueue.cpp b/src/qamqpqueue.cpp index 3e4e724..5a398c7 100644 --- a/src/qamqpqueue.cpp +++ b/src/qamqpqueue.cpp @@ -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" diff --git a/src/qamqpqueue.h b/src/qamqpqueue.h index cbcdbc6..ebd0d85 100644 --- a/src/qamqpqueue.h +++ b/src/qamqpqueue.h @@ -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); diff --git a/src/qamqpqueue_p.h b/src/qamqpqueue_p.h index eceffed..23ba928 100644 --- a/src/qamqpqueue_p.h +++ b/src/qamqpqueue_p.h @@ -22,6 +22,8 @@ public: QAmqpQueuePrivate(QAmqpQueue *q); ~QAmqpQueuePrivate(); + virtual void resetInternalState(); + void declare(); virtual bool _q_method(const QAmqpMethodFrame &frame);