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
This commit is contained in:
kurtis.heimerl
2013-02-05 10:05:19 +00:00
parent 0e9638960b
commit b493534bd7
2 changed files with 23 additions and 8 deletions

View File

@@ -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;
}

View File

@@ -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(); }