From d1bb8df38c3962aa40a3df13f75e788f535ea669 Mon Sep 17 00:00:00 2001 From: pat Date: Mon, 13 Oct 2014 19:20:59 -0700 Subject: [PATCH] Reverse service order of CCCH priority queue. Add LOG(DEBUG) to check it, and some miscellaneous comments. --- GSM/GSMCCCH.cpp | 6 +++--- GSM/GSMCommon.h | 2 +- GSM/GSMLogicalChannel.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GSM/GSMCCCH.cpp b/GSM/GSMCCCH.cpp index 9cda9db..0c5822c 100644 --- a/GSM/GSMCCCH.cpp +++ b/GSM/GSMCCCH.cpp @@ -133,13 +133,13 @@ struct RachCompareAdapter { /** Compare the objects pointed to, not the pointers themselves. */ // (pat) This is used when a RachInfo is placed in a priority_queue. // Return true if rach1 should appear before rach2 in the priority_queue, - // meaning that rach1 will be serviced before rach2. + // meaning that rach2 will be serviced before rach1, since the stupid C++ priority_queue pops from the END of the queue. bool operator()(const RachInfo *rach1, const RachInfo *rach2) { assert(!rach1->mChan == !rach2->mChan); // In any given queue, all raches have mChan, or none. if (rach1->mChan) { - return rach1->mReadyTime < rach2->mReadyTime; + return rach1->mReadyTime > rach2->mReadyTime; } else { - return rach1->mWhen < rach2->mWhen; + return rach1->mWhen > rach2->mWhen; } } }; diff --git a/GSM/GSMCommon.h b/GSM/GSMCommon.h index cde6f24..58b553b 100644 --- a/GSM/GSMCommon.h +++ b/GSM/GSMCommon.h @@ -316,7 +316,7 @@ extern const unsigned RACHWaitSParamCombined[16]; /**@name Modulus operations for frame numbers. */ //@{ /** The GSM hyperframe is largest time period in the GSM system, GSM 05.02 4.3.3. */ -// It is 2715648 +// It is 2715648 or 3 hours, 28 minutes, 53 seconds const uint32_t gHyperframe = 2048UL * 26UL * 51UL; /** Get a clock difference, within the modulus, v1-v2. */ diff --git a/GSM/GSMLogicalChannel.cpp b/GSM/GSMLogicalChannel.cpp index 5b42169..18de823 100644 --- a/GSM/GSMLogicalChannel.cpp +++ b/GSM/GSMLogicalChannel.cpp @@ -324,7 +324,7 @@ void SACCHLogicalChannel::l2sendf(const L3Frame& frame) L3Frame * L2LogicalChannel::l2recv(unsigned timeout_ms) { - LOG(DEBUG); + //LOG(DEBUG); L3Frame *result = mL3Out.read(timeout_ms); if (result) WATCHINFO("l2recv " << this <getSAPI()) <