Author: tross
Date: Thu Nov 13 12:50:44 2008
New Revision: 713817
URL: http://svn.apache.org/viewvc?rev=713817&view=rev
Log:
Added a second level of debug output for the qmf protocol exchange.
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp?rev=713817&r1=713816&r2=713817&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp Thu
Nov 13 12:50:44 2008
@@ -248,6 +248,10 @@
uint32_t length = 512 - buffer.available();
buffer.reset();
connThreadBody.sendBuffer(buffer, length, "qpid.management", "broker");
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "SENT AttachRequest: reqBroker=" << requestedBrokerBank <<
+ " reqAgent=" << requestedAgentBank << endl;
+ }
}
void ManagementAgentImpl::storeData(bool requested)
@@ -295,6 +299,9 @@
outLen = MA_BUFFER_SIZE - outBuffer.available();
outBuffer.reset();
connThreadBody.sendBuffer(outBuffer, outLen, "amq.direct", replyToKey);
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "SENT CommandComplete: seq=" << sequence << " code=" << code
<< " text=" << text << endl;
+ }
}
void ManagementAgentImpl::handleAttachResponse(Buffer& inBuffer)
@@ -303,6 +310,12 @@
assignedBrokerBank = inBuffer.getLong();
assignedAgentBank = inBuffer.getLong();
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "RCVD AttachResponse: broker=" << assignedBrokerBank <<
+ " agent=" << assignedAgentBank << endl;
+ }
+
if ((assignedBrokerBank != requestedBrokerBank) ||
(assignedAgentBank != requestedAgentBank)) {
if (requestedAgentBank == 0)
@@ -355,20 +368,28 @@
inBuffer.getShortString(key.name);
inBuffer.getBin128(key.hash);
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "RCVD SchemaRequest: package=" << packageName << " class=" <<
key.name << endl;
+ }
+
PackageMap::iterator pIter = packages.find(packageName);
if (pIter != packages.end()) {
ClassMap& cMap = pIter->second;
ClassMap::iterator cIter = cMap.find(key);
if (cIter != cMap.end()) {
SchemaClass& schema = cIter->second;
- Buffer outBuffer(outputBuffer, MA_BUFFER_SIZE);
- uint32_t outLen;
+ Buffer outBuffer(outputBuffer, MA_BUFFER_SIZE);
+ uint32_t outLen;
- encodeHeader(outBuffer, 's', sequence);
- schema.writeSchemaCall(outBuffer);
- outLen = MA_BUFFER_SIZE - outBuffer.available();
- outBuffer.reset();
- connThreadBody.sendBuffer(outBuffer, outLen, "qpid.management",
"broker");
+ encodeHeader(outBuffer, 's', sequence);
+ schema.writeSchemaCall(outBuffer);
+ outLen = MA_BUFFER_SIZE - outBuffer.available();
+ outBuffer.reset();
+ connThreadBody.sendBuffer(outBuffer, outLen, "qpid.management",
"broker");
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "SENT SchemaInd: package=" << packageName << " class="
<< key.name << endl;
+ }
}
}
}
@@ -377,6 +398,10 @@
{
Mutex::ScopedLock lock(agentLock);
clientWasAdded = true;
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "RCVD ConsoleAddedInd" << endl;
+ }
}
void ManagementAgentImpl::invokeMethodRequest(Buffer& inBuffer, uint32_t
sequence, string replyTo)
@@ -430,6 +455,11 @@
moveNewObjectsLH();
ft.decode(inBuffer);
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "RCVD GetQuery: map=" << ft << endl;
+ }
+
value = ft.get("_class");
if (value.get() == 0 || !value->convertsTo<string>()) {
value = ft.get("_objectid");
@@ -449,6 +479,10 @@
outLen = MA_BUFFER_SIZE - outBuffer.available ();
outBuffer.reset ();
connThreadBody.sendBuffer(outBuffer, outLen, "amq.direct",
replyTo);
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "SENT ObjectInd" << endl;
+ }
}
sendCommandComplete(replyTo, sequence);
return;
@@ -470,6 +504,10 @@
outLen = MA_BUFFER_SIZE - outBuffer.available();
outBuffer.reset();
connThreadBody.sendBuffer(outBuffer, outLen, "amq.direct",
replyTo);
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "SENT ObjectInd" << endl;
+ }
}
}
@@ -488,6 +526,10 @@
} else {
invokeMethodRequest(inBuffer, sequence, replyTo);
}
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "RCVD MethodRequest" << endl;
+ }
}
void ManagementAgentImpl::received(Message& msg)
@@ -595,6 +637,10 @@
PackageMap::iterator pIter)
{
buf.putShortString((*pIter).first);
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "SENT PackageInd: package=" << (*pIter).first << endl;
+ }
}
void ManagementAgentImpl::encodeClassIndication(Buffer& buf,
@@ -607,6 +653,10 @@
buf.putShortString((*pIter).first);
buf.putShortString(key.name);
buf.putBin128(key.hash);
+
+ if (debugLevel >= DEBUG_PROTO) {
+ cout << "SENT ClassInd: package=" << (*pIter).first << " class=" <<
key.name << endl;
+ }
}
void ManagementAgentImpl::periodicProcessing()
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h?rev=713817&r1=713816&r2=713817&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h Thu Nov
13 12:50:44 2008
@@ -148,6 +148,11 @@
uint16_t bootSequence;
uint8_t debugLevel;
+ static const uint8_t DEBUG_OFF = 0;
+ static const uint8_t DEBUG_CONN = 1;
+ static const uint8_t DEBUG_PROTO = 2;
+ static const uint8_t DEBUG_PUBLISH = 3;
+
# define MA_BUFFER_SIZE 65536
char outputBuffer[MA_BUFFER_SIZE];
char eventBuffer[MA_BUFFER_SIZE];