From 814247478aebc94a90562a6edda90d477702f613 Mon Sep 17 00:00:00 2001 From: Djimmer Date: Thu, 21 May 2015 14:00:22 +0200 Subject: [PATCH] Inserted TESTCALL logging everywhere I could find --- Control/L3CallControl.cpp | 30 +++++++++++++++--------------- Control/L3MMLayer.cpp | 19 ++++++++++++++++++- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/Control/L3CallControl.cpp b/Control/L3CallControl.cpp index d04cbd9..3c6a57c 100644 --- a/Control/L3CallControl.cpp +++ b/Control/L3CallControl.cpp @@ -1296,37 +1296,36 @@ MachineStatus InCallMachine::machineRunState(int state, const GSM::L3Message *l3 void CCBase::TestCall(TranEntry* tran) { - LOG(INFO) << " transaction: "<< *tran; + LOG(TESTCALL) << "Entering L3CallControl::CCBase::TestCall with transaction: " << LOGVAR(tran); // Mark the call as active. setGSMState(CCState::Active); + LOG(TESTCALL) << "Creating UDP Socket on port: " << gConfig.getNum("TestCall.Port"); // Create and open the control port. UDPSocket controlSocket(gConfig.getNum("TestCall.Port")); - + LOG(TESTCALL) << "Active UDP Socket on port: " << gConfig.getNum("TestCall.Port"); // FIXME -- Somehow, the RTP ports need to be attached to the transaction. // This loop will run or block until some outside entity writes a // channel release on the socket. - LOG(WARNING) << "entering test loop"; - int test = 0; - while (test = 3) { + LOG(TESTCALL) << "Entering UDP test loop "; + + while (true) { // Get the outgoing message from the test call port. char iBuf[MAX_UDP_LENGTH]; int msgLen = (size_t)controlSocket.read(iBuf); - LOG(WARNING) << "got " << msgLen << " bytes on UDP"; + LOG(TESTCALL) << "Received " << msgLen << " bytes on UDP"; + // Send it to the handset. - - //TODO GSM::L3Frame query(iBuf, msgLen); - - LOG(WARNING) << "sending " << query; + LOG(TESTCALL) << " Sending L3Frame: " << LOGVAR(query); channel()->l3sendf(query); + // Wait for a response. // FIXME -- This should be a proper T3xxx value of some kind. GSM::L3Frame *resp = channel()->l2recv(30000); - //GSM::L3Frame* resp = LCH->recv(30000); if (!resp) { - LOG(WARNING) << "read timeout"; + LOG(TESTCALL) << "Timeout ; No response"; break; } @@ -1335,21 +1334,22 @@ void CCBase::TestCall(TranEntry* tran) // LOG(WARNING) << "unexpected primitive " << resp->primitive(); // break; // } - LOG(WARNING) << "received " << *resp; + LOG(TESTCALL) << "Received response from handset: " << LOGVAR(resp); + // Send response on the port. unsigned char oBuf[resp->size()]; resp->pack(oBuf); controlSocket.writeBack((char*)oBuf); // Delete and close the loop. delete resp; - test = test + 1; } + LOG(TESTCALL) << "Stopping L3CallControl::CCBase::Testcall function"; controlSocket.close(); - LOG(WARNING) << "ending"; channel()->l3sendm(L3ChannelRelease()); setGSMState(CCState::ReleaseRequest); tran -> handleMachineStatus(MachineStatus::MachineCodeQuitTran); + LOG(TESTCALL) << "Stopped L3CallControl::CCBase::Testcall function"; } diff --git a/Control/L3MMLayer.cpp b/Control/L3MMLayer.cpp index 12ea243..87c7771 100644 --- a/Control/L3MMLayer.cpp +++ b/Control/L3MMLayer.cpp @@ -84,6 +84,7 @@ void MMContext::startSMSTran(TranEntry *tran) // Setting the lock in one function and releasing it in another sucks and should be fixed. bool MMUser::mmuServiceMTQueues() // arg redundant with mmuContext->channel. { + LOG(TESTCALL) << "MMUser::mmuServiceMTQueues started"; devassert(gMMLock.lockcnt()); // Caller locked it. //ScopedLock lock(mmuLock,__FILE__,__LINE__); // TODO: check for blocks on our IMSI or TMSI? @@ -118,6 +119,22 @@ bool MMUser::mmuServiceMTQueues() // arg redundant with mmuContext->channel. return true; } } + //TODO: Is this If correct? + if (mmuContext->mmGetTran(MMContext::TE_CS1).isNULL()) { + if (mmuTESTCALL.size()) { + TranEntry *tran = mmuMTCq.pop_frontr(); + LOG(TESTCALL) << "MMUser::mmuServiceMTQueues inside mmuTESTCALL if, with: "<< LOGVAR(tran); + + // Tie the transaction to this channel. + mmuContext->mmConnectTran(MMContext::TE_CS1,tran); + // Unlock and run Testcall function + gMMLock.unlock(); + TestCall(tran) + return true; + } + } + + return false; } @@ -702,8 +719,8 @@ void MMUser::mmuAddMT(TranEntry *tran) mmuMTSMSq.push_back(tran); break; case L3CMServiceType::TestCall: - mmuTESTCALL.push_back(tran); LOG(TESTCALL) << "Entering the L3CMServiceType::Testcall branch of the case+switch"; + mmuTESTCALL.push_back(tran); break; default: assert(0);