From 0d1c48aa8f8c6020a930174962314cbf500bd09b Mon Sep 17 00:00:00 2001 From: paulc Date: Thu, 24 Mar 2011 14:23:09 +0000 Subject: [PATCH] Adjusted debugging in MGCP, prevent log spamming. git-svn-id: http://yate.null.ro/svn/yate/trunk@4212 acf43c95-373e-0410-b603-e72c3f656dc1 --- libs/ymgcp/engine.cpp | 12 ++++++------ libs/ymgcp/transaction.cpp | 8 +++++--- modules/server/mgcpca.cpp | 26 +++++++++++++++----------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/libs/ymgcp/engine.cpp b/libs/ymgcp/engine.cpp index 900341f4..7a1ee805 100644 --- a/libs/ymgcp/engine.cpp +++ b/libs/ymgcp/engine.cpp @@ -69,14 +69,14 @@ MGCPPrivateThread::MGCPPrivateThread(MGCPEngine* engine, bool process, m_engine(engine), m_action(process?Process:Receive) { - XDebug(m_engine,DebugInfo,"MGCPPrivateThread::MGCPPrivateThread() [%p]",this); + DDebug(m_engine,DebugInfo,"MGCPPrivateThread::MGCPPrivateThread() [%p]",this); if (m_engine) m_engine->appendThread(this); } MGCPPrivateThread::~MGCPPrivateThread() { - XDebug(m_engine,DebugInfo,"MGCPPrivateThread::~MGCPPrivateThread() [%p]",this); + DDebug(m_engine,DebugInfo,"MGCPPrivateThread::~MGCPPrivateThread() [%p]",this); if (m_engine) m_engine->removeThread(this); } @@ -431,7 +431,7 @@ bool MGCPEngine::receive(unsigned char* buffer, SocketAddr& addr) new MGCPTransaction(this,msg,false,addr); continue; } - DDebug(this,DebugNote,"Received response %d for unknown transaction %u", + Debug(this,DebugNote,"Received response %d for unknown transaction %u", msg->code(),msg->transactionId()); TelEngine::destruct(msg); } @@ -569,16 +569,16 @@ void MGCPEngine::cleanup(bool gracefully, const char* text) return; // Terminate private threads - XDebug(this,DebugAll,"Terminating %u private threads",m_threads.count()); + Debug(this,DebugAll,"Terminating %u private threads",m_threads.count()); lock(); ListIterator iter(m_threads); for (GenObject* o = 0; 0 != (o = iter.get());) static_cast(o)->cancel(!gracefully); unlock(); - XDebug(this,DebugAll,"Waiting for private threads to terminate"); + DDebug(this,DebugAll,"Waiting for private threads to terminate"); while (m_threads.skipNull()) Thread::yield(); - XDebug(this,DebugAll,"Private threads terminated"); + DDebug(this,DebugAll,"Private threads terminated"); } // Write data to socket diff --git a/libs/ymgcp/transaction.cpp b/libs/ymgcp/transaction.cpp index bfb90343..802c1831 100644 --- a/libs/ymgcp/transaction.cpp +++ b/libs/ymgcp/transaction.cpp @@ -310,7 +310,7 @@ void MGCPTransaction::processMessage(MGCPMessage* msg) retrans = true; send(m_ack); } - Debug(m_engine,(ok || retrans) ? DebugAll : DebugNote, + DDebug(m_engine,(ok || retrans) ? DebugAll : DebugNote, "%s. Received %sresponse %d [%p]",m_debug.c_str(), ok?"":(retrans?"retransmission for ":"different "),msg->code(),this); } @@ -318,7 +318,7 @@ void MGCPTransaction::processMessage(MGCPMessage* msg) ok = (!m_response && !m_provisional); if (ok) m_provisional = msg; - Debug(m_engine,(ok || m_response)? DebugAll : DebugNote, + DDebug(m_engine,(ok || m_response)? DebugAll : DebugNote, "%s. Received %sprovisional response %d [%p]",m_debug.c_str(), ok?"":(m_response?"late ":"different "),msg->code(),this); } @@ -474,8 +474,10 @@ MGCPEvent* MGCPTransaction::terminate() m_engine->removeTrans(this,false); if (m_timeout) Debug(m_engine,DebugNote,"%s. Timeout in state %u [%p]",m_debug.c_str(),state(),this); +#ifdef DEBUG else - DDebug(m_engine,DebugAll,"%s. Terminated in state %u [%p]",m_debug.c_str(),state(),this); + Debug(m_engine,DebugAll,"%s. Terminated in state %u [%p]",m_debug.c_str(),state(),this); +#endif MGCPEvent* event = new MGCPEvent(this); deref(); return event; diff --git a/modules/server/mgcpca.cpp b/modules/server/mgcpca.cpp index 48708c70..05df6b69 100644 --- a/modules/server/mgcpca.cpp +++ b/modules/server/mgcpca.cpp @@ -391,7 +391,7 @@ bool YMGCPEngine::processEvent(MGCPTransaction* trans, MGCPMessage* msg, void* d MGCPWrapper* wrap = YOBJECT(MGCPWrapper,static_cast(data)); MGCPSpan* span = YOBJECT(MGCPSpan,static_cast(data)); MGCPCircuit* circ = YOBJECT(MGCPCircuit,static_cast(data)); - Debug(this,DebugAll,"YMGCPEngine::processEvent(%p,%p,%p) wrap=%p span=%p circ=%p [%p]", + DDebug(this,DebugAll,"YMGCPEngine::processEvent(%p,%p,%p) wrap=%p span=%p circ=%p [%p]", trans,msg,data,wrap,span,circ,this); if (!trans) return false; @@ -566,7 +566,7 @@ MGCPWrapper::~MGCPWrapper() // Process incoming events for this wrapper bool MGCPWrapper::processEvent(MGCPTransaction* tr, MGCPMessage* mm) { - Debug(&splugin,DebugAll,"MGCPWrapper::processEvent(%p,%p) [%p]", + DDebug(&splugin,DebugAll,"MGCPWrapper::processEvent(%p,%p) [%p]", tr,mm,this); if (tr == m_tr) { if (!mm || (tr->msgResponse())) { @@ -713,11 +713,13 @@ RefPointer MGCPWrapper::sendSync(MGCPMessage* mm, const SocketAddr& Thread::idle(); RefPointer tmp = m_msg; m_msg = 0; - if (tmp) - Debug(&splugin,DebugNote,"MGCPWrapper::sendSync() returning %d '%s' [%p]", - tmp->code(),tmp->comment().c_str(),this); - else + if (!tmp) Debug(&splugin,DebugMild,"MGCPWrapper::sendSync() returning NULL [%p]",this); +#ifdef DEBUG + else + Debug(&splugin,DebugInfo,"MGCPWrapper::sendSync() returning %d '%s' [%p]", + tmp->code(),tmp->comment().c_str(),this); +#endif return tmp; } @@ -1428,11 +1430,13 @@ RefPointer MGCPCircuit::sendSync(MGCPMessage* mm) Thread::idle(); RefPointer tmp = m_msg; m_msg = 0; - if (tmp) - Debug(&splugin,DebugNote,"MGCPCircuit::sendSync() returning %d '%s' [%p]", - tmp->code(),tmp->comment().c_str(),this); - else + if (!tmp) Debug(&splugin,DebugMild,"MGCPCircuit::sendSync() returning NULL [%p]",this); +#ifdef DEBUG + else + Debug(&splugin,DebugInfo,"MGCPCircuit::sendSync() returning %d '%s' [%p]", + tmp->code(),tmp->comment().c_str(),this); +#endif return tmp; } @@ -1760,7 +1764,7 @@ bool MGCPCircuit::sendEvent(SignallingCircuitEvent::Type type, NamedList* params // Process incoming events for this circuit bool MGCPCircuit::processEvent(MGCPTransaction* tr, MGCPMessage* mm) { - Debug(&splugin,DebugAll,"MGCPCircuit::processEvent(%p,%p) [%p]", + DDebug(&splugin,DebugAll,"MGCPCircuit::processEvent(%p,%p) [%p]", tr,mm,this); if (tr == m_tr) { if (!mm || (tr->msgResponse())) {