don't store content message in Content frame

the message was being needlessly duplicated into the Content frame,
now we only store the size there to be sent out, rather than the whole
message

remove QAMQP prefix in authenticator
This commit is contained in:
Matt Broadstone 2014-08-03 14:11:21 -04:00
parent d9d2a677b9
commit 4ea3bdb851
4 changed files with 10 additions and 16 deletions

View File

@ -40,9 +40,9 @@ void AMQPlainAuthenticator::setPassword(const QString &p)
void AMQPlainAuthenticator::write(QDataStream &out) void AMQPlainAuthenticator::write(QDataStream &out)
{ {
QAMQP::Frame::writeField('s', out, type()); Frame::writeField('s', out, type());
QAMQP::Frame::TableField response; Frame::TableField response;
response["LOGIN"] = login_; response["LOGIN"] = login_;
response["PASSWORD"] = password_; response["PASSWORD"] = password_;
QAMQP::Frame::serialize(out, response); Frame::serialize(out, response);
} }

View File

@ -261,7 +261,7 @@ void Exchange::publish(const QByteArray &message, const QString &routingKey,
MessageProperties::ConstIterator itEnd = properties.constEnd(); MessageProperties::ConstIterator itEnd = properties.constEnd();
for (it = properties.constBegin(); it != itEnd; ++it) for (it = properties.constBegin(); it != itEnd; ++it)
content.setProperty(it.key(), it.value()); content.setProperty(it.key(), it.value());
content.setBody(message); content.setBodySize(message.size());
d->sendFrame(content); d->sendFrame(content);
int fullSize = message.size(); int fullSize = message.size();

View File

@ -514,7 +514,7 @@ qint32 Content::size() const
buffer_.clear(); buffer_.clear();
out << qint16(methodClass_); out << qint16(methodClass_);
out << qint16(0); //weight out << qint16(0); //weight
out << qlonglong(body_.size()); out << qlonglong(bodySize_);
qint16 prop_ = 0; qint16 prop_ = 0;
foreach (int p, properties_.keys()) foreach (int p, properties_.keys())
@ -566,14 +566,14 @@ qint32 Content::size() const
return buffer_.size(); return buffer_.size();
} }
void Content::setBody(const QByteArray &data) qlonglong Content::bodySize() const
{ {
body_ = data; return bodySize_;
} }
QByteArray Content::body() const void Content::setBodySize(qlonglong size)
{ {
return body_; bodySize_ = size;
} }
void Content::setProperty(Property prop, const QVariant &value) void Content::setProperty(Property prop, const QVariant &value)
@ -641,10 +641,6 @@ void Content::readPayload(QDataStream &in)
properties_[cpClusterID] = readField('s', in); properties_[cpClusterID] = readField('s', in);
} }
qlonglong Content::bodySize() const
{
return body_.isEmpty() ? bodySize_ : body_.size();
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ContentBody::ContentBody() ContentBody::ContentBody()

View File

@ -322,16 +322,14 @@ namespace Frame
*/ */
QVariant property(Property prop) const; QVariant property(Property prop) const;
void setBody(const QByteArray &data);
QByteArray body() const;
qlonglong bodySize() const; qlonglong bodySize() const;
void setBodySize(qlonglong size);
protected: protected:
void writePayload(QDataStream &stream) const; void writePayload(QDataStream &stream) const;
void readPayload(QDataStream &stream); void readPayload(QDataStream &stream);
short methodClass_; short methodClass_;
qint16 id_; qint16 id_;
QByteArray body_;
mutable QByteArray buffer_; mutable QByteArray buffer_;
QHash<int, QVariant> properties_; QHash<int, QVariant> properties_;
qlonglong bodySize_; qlonglong bodySize_;