From f9e71e7747b88df515e7de88af5f960b83aa13cd Mon Sep 17 00:00:00 2001 From: Kurtis Heimerl Date: Tue, 5 Feb 2013 10:05:19 +0000 Subject: [PATCH] Potentially fixed a bug where a message sent from the CLI isn't responded to, gets cleared from the paging table and then segfaults as it has no invite attached. git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4882 19bc5d8c-e614-43d4-8b26-e1612bc8e597 --- Control/TransactionTable.cpp | 24 +++++++++++++++++------- Control/TransactionTable.h | 7 ++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Control/TransactionTable.cpp b/Control/TransactionTable.cpp index a5f6855..9a6e4d8 100644 --- a/Control/TransactionTable.cpp +++ b/Control/TransactionTable.cpp @@ -100,7 +100,8 @@ TransactionEntry::TransactionEntry( const L3CMServiceType& wService, const L3CallingPartyBCDNumber& wCalling, GSM::CallState wState, - const char *wMessage) + const char *wMessage, + bool wFake) :mID(gTransactionTable.newID()), mSubscriber(wSubscriber),mService(wService), mL3TI(gTMSITable.nextL3TI(wSubscriber.digits())), @@ -110,7 +111,9 @@ TransactionEntry::TransactionEntry( mNumSQLTries(gConfig.getNum("Control.NumSQLTries")), mChannel(wChannel), mTerminationRequested(false), - mRemoved(false) + mRemoved(false), + mFake(wFake) + { if (wMessage) mMessage.assign(wMessage); //strncpy(mMessage,wMessage,160); else mMessage.assign(""); //mMessage[0]='\0'; @@ -134,7 +137,8 @@ TransactionEntry::TransactionEntry( mNumSQLTries(gConfig.getNum("Control.NumSQLTries")), mChannel(wChannel), mTerminationRequested(false), - mRemoved(false) + mRemoved(false), + mFake(false) { assert(mSubscriber.type()==GSM::IMSIType); mMessage.assign(""); //mMessage[0]='\0'; @@ -157,7 +161,8 @@ TransactionEntry::TransactionEntry( mNumSQLTries(2*gConfig.getNum("Control.NumSQLTries")), mChannel(wChannel), mTerminationRequested(false), - mRemoved(false) + mRemoved(false), + mFake(false) { mMessage.assign(""); //mMessage[0]='\0'; initTimers(); @@ -180,7 +185,8 @@ TransactionEntry::TransactionEntry( mNumSQLTries(gConfig.getNum("Control.NumSQLTries")), mChannel(wChannel), mTerminationRequested(false), - mRemoved(false) + mRemoved(false), + mFake(false) { assert(mSubscriber.type()==GSM::IMSIType); if (wMessage!=NULL) mMessage.assign(wMessage); //strncpy(mMessage,wMessage,160); @@ -202,7 +208,8 @@ TransactionEntry::TransactionEntry( mNumSQLTries(gConfig.getNum("Control.NumSQLTries")), mChannel(wChannel), mTerminationRequested(false), - mRemoved(false) + mRemoved(false), + mFake(false) { assert(mSubscriber.type()==GSM::IMSIType); mMessage[0]='\0'; @@ -955,7 +962,10 @@ bool TransactionTable::removePaging(unsigned key) if (itr==mTable.end()) return false; if (itr->second->removed()) return true; if (itr->second->GSMState()!=GSM::Paging) return false; - itr->second->MODSendERROR(NULL, 480, "Temporarily Unavailable", true); + //no one to respond to if we're fake + if (!itr->second->fake()){ + itr->second->MODSendERROR(NULL, 480, "Temporarily Unavailable", true); + } itr->second->remove(); return true; } diff --git a/Control/TransactionTable.h b/Control/TransactionTable.h index b260eeb..3cb417a 100644 --- a/Control/TransactionTable.h +++ b/Control/TransactionTable.h @@ -98,6 +98,8 @@ class TransactionEntry { volatile bool mRemoved; ///< true if ready for removal + bool mFake; ///true if this is a fake message generated internally + public: /** This form is used for MTC or MT-SMS with TI generated by the network. */ @@ -107,7 +109,8 @@ class TransactionEntry { const GSM::L3CMServiceType& wService, const GSM::L3CallingPartyBCDNumber& wCalling, GSM::CallState wState = GSM::NullState, - const char *wMessage = NULL); + const char *wMessage = NULL, + bool wFake=false); /** This form is used for MOC, setting mGSMState to MOCInitiated. */ TransactionEntry(const char* proxy, @@ -159,6 +162,8 @@ class TransactionEntry { const GSM::L3CallingPartyBCDNumber& calling() const { return mCalling; } + bool fake() const {return mFake; } + const char* message() const { return mMessage.c_str(); } void message(const char *wMessage, size_t length); const char* messageType() const { return mContentType.c_str(); }