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