laforge
/
openbts-osmo
Archived
1
0
Fork 0

Gracefully shutdown OpenBTS on transceiver timeout/error.

master
Alexander Chemeris 12 years ago committed by Thomas Tsou
parent 0e6f974b1e
commit 1965ab4255
  1. 7
      public-trunk/TRXManager/TRXManager.cpp
  2. 6
      public-trunk/apps/OpenBTS.cpp

@ -32,6 +32,7 @@
#include "GSMConfig.h"
#include "GSML1FEC.h"
#include <string.h>
#include <stdexcept>
#include <Logger.h>
@ -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;
}

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