diff --git a/public-trunk/TRXManager/TRXManager.cpp b/public-trunk/TRXManager/TRXManager.cpp index bd8f40a..c378300 100644 --- a/public-trunk/TRXManager/TRXManager.cpp +++ b/public-trunk/TRXManager/TRXManager.cpp @@ -32,6 +32,7 @@ #include "GSMConfig.h" #include "GSML1FEC.h" #include +#include #include @@ -39,6 +40,8 @@ using namespace GSM; using namespace std; +// From OpenBTS.cpp +extern void shutdownOpenbts(); TransceiverManager::TransceiverManager(int numARFCNs, const char* wTRXAddress, int wBasePort) @@ -85,11 +88,13 @@ void TransceiverManager::clockHandler() // Did the transceiver die?? if (msgLen<0) { LOG(ALARM) << "TRX clock interface timed out, assuming TRX is dead."; - abort(); + shutdownOpenbts(); + return; } if (msgLen==0) { LOG(ALARM) << "read error on TRX clock interface, return " << msgLen; + shutdownOpenbts(); return; } diff --git a/public-trunk/apps/OpenBTS.cpp b/public-trunk/apps/OpenBTS.cpp index 100aaa5..4c81c7b 100644 --- a/public-trunk/apps/OpenBTS.cpp +++ b/public-trunk/apps/OpenBTS.cpp @@ -112,6 +112,12 @@ static ConnectionServerSocket *sgCLIServerSock = NULL; /// We store Transceiver PID if we started it. static pid_t sgTransceiverPid = 0; +/** Function to shutdown the process when something wrong happens. */ +void shutdownOpenbts() +{ + kill(SIGTERM, getpid()); +} + static void restartTransceiver() { // This is harmless - if someone is running OpenBTS they WANT no transceiver