laforge
/
openbts-osmo
Archived
1
0
Fork 0

Gracefully shutdown OpenBTS on transceiver timeout/error.

This commit is contained in:
Alexander Chemeris 2010-11-23 09:07:34 +03:00 committed by Thomas Tsou
parent 0e6f974b1e
commit 1965ab4255
2 changed files with 12 additions and 1 deletions

View File

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

View File

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