Commit a3d7d341 authored by Benoit Steiner's avatar Benoit Steiner

Corrige les bugs du precedent commit.

Revu entierement le mecanisme de shutdown du bridge, et purge de toutes
les races conditions qui trainaient a ce niveau.

Benny
parent 261d928d
......@@ -99,17 +99,20 @@ int StopBridge(int iErrorStatus)
/* Stop the listener thread if it is running */
iRc |= CancelListener(&listener);
iRc |= FreeListener(&listener);
/* Stop the manager if it is running */
/* Stop the manager if it is running and flush all pending requests */
iRc |= CancelManager(&manager);
iRc |= FreeManager(&manager);
/* Stop the sender if it is running */
iRc |= CancelSender(&sender);
/* Now that the threads are stopped, we can destoy the ressources they
have and that they can share */
iRc |= FreeListener(&listener);
iRc |= FreeSender(&sender);
iRc |= FreeManager(&manager);
/* Close open ressources */
/* Close all over open ressources */
iRc |= CloseConnections();
iRc |= CloseLog();
......@@ -243,12 +246,16 @@ int main(int argc, char **argv)
iRc = ConfigBridge(pfdCfgFile, &strLogFile, &strWaitPort);
/* Initialisation of the mapping structures used by all performer threads */
iRc |= ConfigPerformer(pfdCfgFile);
if (!iRc)
iRc = ConfigPerformer(pfdCfgFile);
/* Setup routing tables in order the bridge to work */
LogScreen(LOG_NOTE, MOD_NAME, "Setting up routing and arp tables...");
iRc |= InitRouting(pfdCfgFile);
iRc |= InitArp(pfdCfgFile);
if (!iRc)
{
LogScreen(LOG_NOTE, MOD_NAME, "Setting up routing and arp tables...");
iRc |= InitRouting(pfdCfgFile);
iRc |= InitArp(pfdCfgFile);
}
}
/* Close cfg file */
......@@ -310,7 +317,8 @@ int main(int argc, char **argv)
// }
//#endif
/* The init process is now finished: start to work if there was no error, else warn that there was a pb and exit */
/* The init process is now finished: start to work if there was no error,
else warn that there was a pb and exit */
if (iRc)
{
/* We just printed before the operation that failed, so don't have to remind it.
......
......@@ -4,25 +4,25 @@
BEGIN Globals # Config generale du bridge
Port = 2000
Log = /home/benny
Log = /home/benny/projet/VLANbridge/BRIDGELOG
END
BEGIN Interfaces # Config du performer
VLANcount = 16 # Nombre de VLANs
VLANdefault = 2 # VLAN par defaut
VLAN2 = eth0 # Mapping VLAN / If
# VLAN3 = eth1
VLAN3 = eth1
# VLAN15 = eth2
# VLAN16 = eth3
END
BEGIN Router
IP = 138.195.136.1 # IP du router
MAC = # MAC du router
MAC = 08:00:02:1A:3D:89 # MAC du router
END
BEGIN Hosts # Definitions des clients potentiels
Start = 138.195.136.2
End = 138.195.137.255
End = 138.195.136.5
Forbidden = 138.195.136.1
END
......@@ -24,7 +24,7 @@
/* Remove an element given by its address from the list */
/* No check is done on the arguments ! */
/***************************************************************************/
int Remove(struct s_Base* psbBase, struct s_Cell* pcCellPos)
static int Remove(struct s_Base* psbBase, struct s_Cell* pcCellPos)
{
ASSERT(psbBase);
ASSERT(pcCellPos);
......@@ -49,9 +49,11 @@ struct s_Base* CreateBase()
{
/* Allocate the list */
struct s_Base* psbBase = malloc(sizeof (struct s_Base));
//printf("Creating base\n");
/* Initialise it */
if (psbBase > 0)
if (psbBase != NULL)
{
/* List is empty */
psbBase->iSize = 0;
......@@ -79,6 +81,8 @@ int DestroyBase(struct s_Base* psbBase)
int iRc = 0;
ASSERT(psbBase);
//printf("Destroying base\n");
/* Empty the list */
while (psbBase->iSize > 0 && !iRc)
......@@ -105,6 +109,9 @@ int AddToBase(struct s_Base* psbBase, struct s_Record* psrNewMember)
ASSERT(psbBase);
ASSERT(psrNewMember);
// printf("Adding to base\n");
if ((pcNewCell = (struct s_Cell *)malloc(sizeof(struct s_Cell))) > 0)
{
/* initialise the links of the new element */
......@@ -138,7 +145,7 @@ struct s_Record* FindInBase(struct s_Base* psbBase, struct sockaddr_in* psaHost)
ASSERT(psbBase);
ASSERT(psaHost);
// printf ("Searching in list...\n");
// printf ("Searching in base...\n");
while (iIndex < psbBase->iSize)
{
......
......@@ -43,6 +43,7 @@ struct s_Fifo* FifoCreate()
/* Initialise the mutex used to access the data */
pthread_mutex_init(&psfFifo->FifoLock, NULL);
pthread_cond_init(&psfFifo->FifoSignal, NULL);
}
else
Log(LOG_ERROR, MOD_NAME, "Could not create fifo");
......@@ -54,9 +55,11 @@ struct s_Fifo* FifoCreate()
/***************************************************************************/
/* Destroy the FIFO */
/***************************************************************************/
int FifoDestroy()
int FifoDestroy(struct s_Fifo* psfFifo)
{
/* TO DO */
pthread_mutex_destroy(&psfFifo->FifoLock);
pthread_cond_destroy(&psfFifo->FifoSignal);
free(psfFifo);
return 0;
}
......@@ -127,9 +130,12 @@ int FifoPull(struct s_Fifo* psfFifo, struct s_Request** psrTask)
{
if (psfFifo->iSize == 0)
{
// printf("FIFO: %p, psfFifo->iSize == 0\n", psfFifo);
/* Wait for something to be pushed in the stack */
iRc = pthread_cond_wait(&psfFifo->FifoSignal, &psfFifo->FifoLock);
}
// printf("Msg received\n");
/* Release the lock */
iRc |= pthread_mutex_unlock(&psfFifo->FifoLock);
......
......@@ -31,7 +31,7 @@ struct s_Fifo
};
struct s_Fifo* FifoCreate();
int FifoDestroy();
int FifoDestroy(struct s_Fifo* psfFifo);
int FifoPush(struct s_Fifo* psfFifo, struct s_Request* psrToStore);
int FifoPull(struct s_Fifo* psfFifo, struct s_Request** psrRequest);
......
......@@ -60,7 +60,8 @@ int InitListener(struct s_Listener* listener)
iRc = pthread_create(&(listener->tid), NULL, ListenerThread, listener);
if (!iRc)
Log (LOG_NOTE, MOD_NAME, "Listener thread successfully created: id %d", listener->tid);
Log (LOG_NOTE, MOD_NAME, "Listener thread successfully created: id %d",
listener->tid);
}
return iRc;
......@@ -150,7 +151,11 @@ int Receive(struct s_Listener* share)
{
for (iIndex = 0; iIndex < VLAN_MSG_LEN; iIndex++)
{
/* We need those testcancel() for classical system calls are not
cancellation points at the present time */
pthread_testcancel();
iConnectionOK = recv(share->iSockFd, strMsg+iIndex, 1, 0);
pthread_testcancel();
/* Check what we received */
if (iConnectionOK <= 0)
......@@ -276,8 +281,15 @@ int CancelListener (struct s_Listener* pslListener)
if (pslListener->tid != 0)
{
Log(LOG_NOTE, MOD_NAME, "Stoppping listener thread");
/* Nothing to do */
Log(LOG_NOTE, MOD_NAME, "Stopping listener thread");
iRc = pthread_cancel(pslListener->tid);
/* Synchronise ourselves with the destruction of the thread */
iRc |= pthread_join(pslListener->tid, NULL);
/* When the thread is cancelled while waiting for a a socket, it relocks
the ConnectionLock, so that the sender thread cannot anymore work for
it shares the ConnectionLock with the listener */
pthread_mutex_trylock(&ConnectionLock);
pthread_mutex_unlock(&ConnectionLock);
}
else
Log(LOG_WARN, MOD_NAME, "Could not stop listener, none is running");
......@@ -296,11 +308,11 @@ int FreeListener(struct s_Listener* pslListener)
ASSERT(pslListener);
if (pslListener->tid != 0)
{
iRc = pthread_cancel(pslListener->tid);
{
iRc |= pthread_cond_destroy(&pslListener->WakeUpSignal);
pslListener = NULL;
/* No more listener is running */
pslListener->tid = 0;
if (!iRc)
Log(LOG_NOTE, MOD_NAME, "Listener thread destroyed");
......@@ -308,10 +320,7 @@ int FreeListener(struct s_Listener* pslListener)
Log(LOG_WARN, MOD_NAME, "Listener thread not cleanly destroyed");
}
else
Log(LOG_WARN, MOD_NAME, "Could not destroy listener, none is running");
/* No more listener is running */
pslListener->tid = 0;
Log(LOG_WARN, MOD_NAME, "Could not destroy listener, none has been created");
return iRc;
}
......
......@@ -174,6 +174,8 @@ int FinishAllTasks(struct s_Manager* psmConfig)
/* Count performers that are currently running */
iRunningPerformers = GetBaseSize(psmConfig->psbBase);
// printf("Base addresss: %p\n", psmConfig->psbBase);
Log(LOG_NOTE, MOD_NAME, "Waiting for the %d running performers to finish",
iRunningPerformers);
......@@ -223,9 +225,13 @@ void* ManagerThread (void *arg)
while (!iMustStop)
{
// printf("New Loop\n");
/* Get a message and wait for one if the FIFO is empty */
iRc = FifoPull(psmConfig->psfWaitingJobs, &psrTask);
// printf("Msg got\n");
if (!iRc)
{
// printf ("received signal: %d\n", psrTask->iNextStep);
......@@ -306,6 +312,8 @@ int InitManager (struct s_Manager* psmManager)
iRc = -1;
}
// printf("Manager base (%p) size: %d\n", psmManager->psbBase, GetBaseSize(psmManager->psbBase));
/* FIFO initialisation */
psmManager->psfWaitingJobs = FifoCreate();
if (psmManager->psfWaitingJobs == NULL)
......@@ -351,14 +359,21 @@ inline int CancelManager(struct s_Manager* psmManager)
ASSERT(psmManager);
if (psmManager->tId != 0)
if (psmManager->tId == 0)
Log(LOG_WARN, MOD_NAME, "Could not stop manager, none is running");
else
{
Log(LOG_NOTE, MOD_NAME, "Stopping manager thread");
psrRequest = malloc(sizeof(struct s_Request));
iRc = pthread_mutex_lock (&psmManager->WorkLock);
if (!iRc)
// printf ("Got lock\n");
if (iRc)
Log(LOG_ERROR, MOD_NAME, "Could not lock mutex: %s", strerror(iRc));
else
{
/* Warn the manager */
iRc = WarnManager(psmManager, psrRequest, EXIT_MANAGER);
......@@ -366,18 +381,28 @@ inline int CancelManager(struct s_Manager* psmManager)
if (iRc)
Log(LOG_ERROR, MOD_NAME, "Unable to send manager termination signal: %s",
strerror(iRc));
else
{
/* Synchronise ourselves wit the destruction of the manager */
if (pthread_join(psmManager->tId, NULL))
{
iRc = -1;
Log(LOG_ERROR, MOD_NAME, "Unable to join manager thread");
}
else
Log(LOG_NOTE, MOD_NAME, "Manager thread is now stopped");
}
if (pthread_mutex_unlock (&psmManager->WorkLock))
{
iRc |= -1;
Log(LOG_ERROR, MOD_NAME, "Could not unlock mutex: %s");
}
}
else
Log(LOG_ERROR, MOD_NAME, "Could not lock mutex: %s", strerror(iRc));
}
else
Log(LOG_WARN, MOD_NAME, "Could not stop manager, none is running");
// printf("Exited from cancel manager\n");
return iRc;
}
......@@ -399,25 +424,25 @@ int FreeManager(struct s_Manager* psmManager)
if (iRc)
Log(LOG_ERROR, MOD_NAME, "Unable to free manager stack");
// printf("Base destroyed\n");
iRc |= pthread_mutex_destroy (&psmManager->WorkLock);
iRc |= pthread_cond_destroy (&psmManager->WorkSignal);
if (iRc)
Log (LOG_ERROR, MOD_NAME, "Unable to free the ressources used by manager thread");
if (pthread_join(psmManager->tId, NULL))
{
iRc |= -1;
Log(LOG_ERROR, MOD_NAME, "Unable to join manager thread");
}
else
Log(LOG_NOTE, MOD_NAME, "Manager thread destroyed");
// printf("Mutex and cond destroyed\n");
}
else
Log(LOG_WARN, MOD_NAME, "Could not destroy manager, none is running");
Log(LOG_WARN, MOD_NAME, "Could not destroy manager, none has been created");
/* No more manager is running */
psmManager->tId = 0;
//printf("Exited from destroy manager\n");
return iRc;
}
......@@ -222,7 +222,6 @@ int InitRouting(FILE* hCfgFile)
{
int iSockFd, iIndex;
int iRc = 0;
// struct sockaddr_in saRouterIP;
struct hostent* heInAddr;
char* strVarName = NULL, *strVarVal = NULL;
......@@ -240,7 +239,7 @@ int InitRouting(FILE* hCfgFile)
{
saRouterIP.sin_family = AF_INET;
if (inet_aton(strVarVal, &saRouterIP.sin_addr) == 0/*INADDR_NONE*/)
if (inet_aton(strVarVal, &saRouterIP.sin_addr) == 0)
{
/* it's not dotted-decimal, try to ask the DNS server */
if ((heInAddr = gethostbyname(strVarVal)) == NULL)
......@@ -252,7 +251,7 @@ int InitRouting(FILE* hCfgFile)
else
{
iRc = 1;
Log(LOG_ERROR, MOD_NAME, "Router must be the first entry in the Router section");
Log(LOG_ERROR, MOD_NAME, "IP must be the first entry in the Router section");
}
/* Get its MAC address */
......@@ -263,6 +262,11 @@ int InitRouting(FILE* hCfgFile)
/* Bug possible, car la conversion ne respecte pas le network byte order */
iRc = mac_atob(strVarVal, (unsigned char *)&saRouterMAC.sa_data);
}
else
{
iRc = 1;
Log(LOG_ERROR, MOD_NAME, "MAC must be the second entry in the Router section");
}
}
else
{
......@@ -273,21 +277,32 @@ int InitRouting(FILE* hCfgFile)
/* Open a socket to manipulate the routing tables */
iSockFd = socket(AF_INET, SOCK_DGRAM, 0);
/* Add an ARP entry for the router on each interface except the default one */
for (iIndex = 1; iIndex < iVLANNumber; iIndex++)
if (iSockFd < 0)
{
iRc = errno;
Log(LOG_ERROR, MOD_NAME, "Could not open temporary socket");
}
else
{
if (strMapToDev[iIndex] != "" && iIndex != iVLANDflt)
iRc = Arp_Add(&saRouterIP, strMapToDev[iIndex], iSockFd);
Log(LOG_NOTE, MOD_NAME, "Adding ARP entries for the router (%s)",
inet_ntoa(saRouterIP.sin_addr));
/* Stop if there was a problem */
if (iRc)
break;
/* Add an ARP entry for the router on each interface except the default one */
for (iIndex = 1; iIndex < iVLANNumber; iIndex++)
{
if (strMapToDev[iIndex] != "" && iIndex != iVLANDflt)
iRc = Arp_Add(&saRouterIP, strMapToDev[iIndex], iSockFd);
/* Stop if there was a problem */
if (iRc)
break;
}
/* Close the socket */
if (close(iSockFd))
Log(LOG_WARN, MOD_NAME, "Unable to close temporary socket: %s", strerror(errno));
}
/* Close the socket */
if (close(iSockFd))
Log(LOG_WARN, MOD_NAME, "Unable to close temporary socket: %s", strerror(errno));
return iRc;
}
......@@ -305,6 +320,8 @@ int InitArp(FILE* hCfgFile)
char* strVarVal = NULL;
struct sockaddr_in saStartAddr;
struct sockaddr_in saStopAddr;
char strStartAddr[17];
char strStopAddr[17];
unsigned long lStartAddr;
unsigned long lStopAddr;
unsigned long lAddr;
......@@ -314,7 +331,9 @@ int InitArp(FILE* hCfgFile)
/* Find the right section */
iRc = FindCfg(hCfgFile, "Hosts");
if (iRc == CFG_OK)
if (iRc != CFG_OK)
Log(LOG_ERROR, MOD_NAME, "Could not find 'Hosts' section");
else
{
/* Read the IP of the first host */
iRc = ReadCfg(hCfgFile, &strVarName, &strVarVal);
......@@ -323,46 +342,71 @@ int InitArp(FILE* hCfgFile)
{
bzero(&saStartAddr, sizeof(saStartAddr));
saStartAddr.sin_family = AF_INET;
iRc = inet_aton(strVarVal, &saStartAddr.sin_addr);
iRc = !inet_aton(strVarVal, &saStartAddr.sin_addr);
strcpy(strStartAddr, inet_ntoa(saStartAddr.sin_addr));
}
else
{
iRc = 1;
Log(LOG_ERROR, MOD_NAME, "Could not read 'Start' entry");
}
else if (!iRc && !strcmp(strVarName, "End"))
/* Read the IP of the last host */
iRc = ReadCfg(hCfgFile, &strVarName, &strVarVal);
if (!iRc && !strcmp(strVarName, "End"))
{
bzero(&saStartAddr, sizeof(saStopAddr));
bzero(&saStopAddr, sizeof(saStopAddr));
saStopAddr.sin_family = AF_INET;
iRc = inet_aton(strVarVal, &saStopAddr.sin_addr);
iRc = !inet_aton(strVarVal, &saStopAddr.sin_addr);
strcpy(strStopAddr, inet_ntoa(saStopAddr.sin_addr));
}
else
{
iRc = 1;
Log(LOG_ERROR, MOD_NAME, "Could not read 'Stop' entry");
}
}
iSockFd = socket (AF_INET, SOCK_DGRAM, 0);
if (iSockFd < 0)
{
iRc = errno;
Log (LOG_ERROR, MOD_NAME, "Unable to open socket: %s", strerror(iRc));
}
else
if (!iRc)
{
/* Loop commence ici */
lStartAddr = ntohl(saStartAddr.sin_addr.s_addr);
lStopAddr = ntohl(saStopAddr.sin_addr.s_addr);
printf("Startaddr: %d, %s\n", lStartAddr, inet_ntoa(saStartAddr.sin_addr));
printf("Stopaddr: %d, %s\n", lStopAddr, inet_ntoa(saStopAddr.sin_addr));
for (lAddr = lStartAddr; lAddr < lStopAddr; lAddr++)
iSockFd = socket (AF_INET, SOCK_DGRAM, 0);
if (iSockFd < 0)
{
iRc = errno;
Log (LOG_ERROR, MOD_NAME, "Unable to open socket: %s", strerror(iRc));
}
else
{
saStartAddr.sin_addr.s_addr = htonl(lAddr);
/* Loop commence ici */
Log(LOG_NOTE, MOD_NAME, "Adding ARP entries for hosts %s to %s",
strStartAddr, strStopAddr);
for (iIndex = 1; iIndex < iVLANNumber; iIndex++)
lStartAddr = ntohl(saStartAddr.sin_addr.s_addr);
lStopAddr = ntohl(saStopAddr.sin_addr.s_addr);
for (lAddr = lStartAddr; lAddr <= lStopAddr; lAddr++)
{
if (strMapToDev[iIndex] != "" && iIndex != iVLANDflt)
Arp_Add(&saStartAddr, strMapToDev[iIndex], iSockFd);
saStartAddr.sin_addr.s_addr = htonl(lAddr);
for (iIndex = 1; iIndex < iVLANNumber; iIndex++)
{
if (strMapToDev[iIndex] != "" && iIndex != iVLANDflt)
iRc = Arp_Add(&saStartAddr, strMapToDev[iIndex], iSockFd);
if (iRc)
break;
}
if (iRc)
break;
}
}
/* Close the socket */
if (close(iSockFd))
Log(LOG_WARN, MOD_NAME, "Unable to close temporary socket: %s", strerror(errno));
}
/* Close the socket */
if (close(iSockFd))
Log(LOG_WARN, MOD_NAME, "Unable to close temporary socket: %s", strerror(errno));
return iRc;
}
......
......@@ -88,10 +88,10 @@ int InitSender (struct s_Sender* sender)
if (!iRc)
{
iRc = pthread_create(&(sender->tid), NULL, SenderThread, sender);
if (!iRc)
Log (LOG_NOTE, MOD_NAME, "Sender thread successfully created: id %d", sender->tid);
Log (LOG_NOTE, MOD_NAME, "Sender thread successfully created: id %d",
sender->tid);
}
return iRc;
......@@ -187,7 +187,12 @@ int Answer(struct s_Sender *share)
else
{
Log(LOG_NOTE, MOD_NAME, "Sending answer to VLANserver: %s", buff);
/* We need those testcancel() for classical system calls are not
cancellation points at the present time */
pthread_testcancel();
iConnectionOK = send(share->iSockFd, buff, strlen(buff), 0);
pthread_testcancel();
/* Check what we sended */
if (iConnectionOK <= 0)
......@@ -282,8 +287,18 @@ int CancelSender(struct s_Sender* pssSender)
if (pssSender->tid != 0)
{
Log(LOG_NOTE, MOD_NAME, "Stoppping sender thread");
/* Nothing t do */
Log(LOG_NOTE, MOD_NAME, "Stopping sender thread");
iRc = pthread_cancel(pssSender->tid);
/* Synchronise ourselves with the destruction of the thread, to avoid to destroy
the condition while the sender is waiting on it */
iRc |= pthread_join(pssSender->tid, NULL);
/* When the thread is cancelled while waiting for a a socket, it relocks
the ConnectionLock, so that the sender thread cannot anymore work for
it shares the ConnectionLock with the listener */
pthread_mutex_trylock(&ConnectionLock);
pthread_mutex_unlock(&ConnectionLock);
}
else
Log(LOG_WARN, MOD_NAME, "Could not stop sender, none is running");
......@@ -302,17 +317,16 @@ int FreeSender(struct s_Sender* pssSender)
ASSERT(pssSender);
if (pssSender->tid != 0)
{
{
iRc = pthread_cond_destroy(&pssSender->WakeUpSignal);
iRc |= pthread_cancel(pssSender->tid);
if (!iRc)
Log(LOG_NOTE, MOD_NAME, "Sender thread destroyed");
else
Log(LOG_WARN, MOD_NAME, "Sender thread not cleanly destroyed");
}
else
Log(LOG_WARN, MOD_NAME, "Could not destroy sender, none is running");
Log(LOG_WARN, MOD_NAME, "Could not destroy sender, none has been created");
/* No more sender is running */
pssSender->tid = 0;
......
......@@ -14,8 +14,6 @@
#define MOD_NAME MOD_VLANBRIDGE
/* A Ctrl-C send more than one SIGINT signal: record that an interupt has been requested to avoid 2 shutdown sequences at the same time */
static int iInterrupt;
/* */
......@@ -23,7 +21,7 @@ void SigHup(int iCrap)
{
Log(LOG_WARN, MOD_NAME, "Received SIGHUP: Hangup detected");
// /* Normally the signal handler should no be reset to its default value */
/* Normally the signal handler should no be reset to its default value */
// signal(SIGHUP, SigHup);
}
......@@ -31,25 +29,36 @@ void SigHup(int iCrap)
/* */
void SigInt(int iCrap)
{
int iRc = 0;
if (iInterrupt == 0)
{
Log(LOG_WARN, MOD_NAME,
"Received SIGINT: Interrupt from keyboard, launching shutdown sequence...");
iInterrupt = SIGINT;
iRc = StopBridge(0);
exit(iRc);
}
else
Log(LOG_WARN, MOD_NAME,
"Received SIGINT: Interrupt from keyboard, ignoring it for a shutdown sequence has already been launched");
/* We don't want to receive any other SIGINT that could interrupt the exit process
before it is complete (unless we could dealloc twice a ressource) */
signal(SIGINT, SIG_IGN);
Log(LOG_WARN, MOD_NAME,
"Received SIGINT: Interrupt from keyboard, launching shutdown sequence...");
exit(StopBridge(0));
}
/* */
void SigTerm(int iCrap)
{
/* We don't want to receive any other SIGTERM that could interrupt the exit process
before it is complete (unless we could dealloc twice a ressource) */
signal(SIGTERM, SIG_IGN);
Log(LOG_WARN, MOD_NAME,
"Received SIGTERM: Software termination signal, exiting...");
exit(StopBridge(0));
}
/* */
void SigQuit(int iCrap)
{
/* We don't want to receive any other SIGTERM that could interrupt the exit process
before it is complete (unless we could dealloc twice a ressource) */
signal(SIGQUIT, SIG_IGN);
Log(LOG_WARN, MOD_NAME,
"Received SIGQUIT: Quit from keyboard, launching shutdown sequence...");
exit(StopBridge(0));
......@@ -72,23 +81,11 @@ void SigPipe(int iCrap)
}
/* */
void SigTerm(int iCrap)
{
Log(LOG_WARN, MOD_NAME,
"Received SIGTERM: Software termination signal, exiting...");
exit(0);
}
/* */
int SetupSigHandlers ()
{
unsigned int iRc = 0;
/* No signal received at that time */
iInterrupt = 0;
/* Setup signal handlers */
if (signal(SIGHUP, SigHup) == SIG_ERR)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment